home *** CD-ROM | disk | FTP | other *** search
/ FishMarket 1.0 / FishMarket v1.0.iso / fishies / 076-100 / disk_093 / microemacs / doc / emacs.mss < prev    next >
Text File  |  1992-05-06  |  106KB  |  2,590 lines

  1. @style(indent 8 chars, spacing 1 lines)
  2. @pagefooting()
  3.  
  4.  
  5.  
  6.  
  7.  
  8.  
  9.  
  10.  
  11.  
  12.  
  13.  
  14.  
  15.         @b(MicroEMACS)
  16.  
  17.         Full Screen Text Editor
  18.         Reference Manual (preliminary draft)
  19.  
  20.         Version 3.8i
  21.         April 27, 1987
  22.  
  23.         (C)opyright 1987 by Daniel M. Lawrence
  24.         Reference Manual (C)opyright 1987
  25.             by Brian Straight and Daniel M. Lawrence
  26.         All Rights Reserved
  27.  
  28.         @i(MicroEMACS 3.8i can be copied and distributed freely
  29.         for any non-commercial purposes. MicroEMACS 3.8i can
  30.         only be incorporated into commercial software with
  31.         the permission of the current author.)
  32. @newpage
  33. @flushleft(@b[Introduction])
  34.  
  35.     MicroEMACS is a tool for creating and changing documents,
  36. programs, and other text files.  It is both relatively easy for the
  37. novice to use, but also very powerfull in the hands of an expert.
  38. MicroEMACS can be extensively customized for the needs of the
  39. individual user.
  40.  
  41.     MicroEMACS allows several files to be edited at the same time.
  42. The screen can be split into different windows, and text may be moved
  43. freely from one window to the next.  Depending on the type of file being
  44. edited, MicroEMACS can change how it behaves to make editing simple. 
  45. Editing standard text files, program files and wordprocessing documents
  46. are all possible at the same time.
  47.  
  48.     There are extensive capabilities to make word processing and
  49. editing easier.  These include commands for string searching and
  50. replacing, paragraph reformatting and deleting, automatic word wrapping,
  51. word move and deletes, easy case controling, and automatic word counts.
  52.  
  53.     For complex and repetitive editing tasks editing macroes can be
  54. written.  These macroes allow the user a great degree of flexibility in
  55. determining how MicroEMACS behaves.  Also any and all the commands can
  56. be used by any keystroke by changing, or rebinding, what commands
  57. various keys are connected, or bound, to. 
  58.  
  59.     Special features are also available to perform a diverse set of
  60. operations such as file encryption, automatic backup file generation,
  61. entabbing and detabbing lines, executing of DOS commands and filtering
  62. of text through other programs (like SORT to allow sorting text).
  63.  
  64. @flushleft(@b[History])
  65.  
  66.     EMACS was originally a text editor written by Richard Stahlman
  67. at MIT in the early 1970s for Digital Equipment computers. Various
  68. versions, rewrites and clones have made an appearence since.
  69.  
  70.     This version of MicroEMACS is derived from code written by Dave
  71. G.  Conroy in 1985.  Later modifications were performed by Steve Wilhite
  72. and George Jones.  In December of 1985 Daniel Lawrence picked up the
  73. then current source (version 2.0) and has made extensive modifications
  74. and additions to it over the course of the next two years.  Updates and
  75. support for the current version is still in progress.  The current
  76. program author can be contacted by writing to:
  77.  
  78. @begin(verbatim)
  79.     USMAIL:    Daniel Lawrence
  80.         617 New York St
  81.         Lafayette, IN 47901
  82.  
  83.     UUCP:    ihnp4!pur-ee!pur-phy!duncan!lawrence
  84.     ARPA:    nwd@@j.cc.purdue.edu
  85.     FIDO:    Fido 201/2 The Programmer's Room (317) 742-5533
  86. @end(verbatim)
  87. @string(ChapterTitle="")
  88. @set(page = 0)
  89. @pageheading(even, left "@title[Chapter]", right "MicroEMACS Reference Manual")
  90. @pageheading(odd, left "MicroEMACS Reference Manual", right "@title[Chapter]")
  91. @pagefooting(even, left="@value(page)")
  92. @pagefooting(odd, right="@value(page)")
  93. @chapter(Basic Concepts)
  94.  
  95.     The current version of MicroEMACS is 3.8i (Third major re-write,
  96. eighth public release, Ith (or ninth) minor release), and for the rest of
  97. this document, we shall simply refer to this version as "EMACS".  Any
  98. modifications for later versions will be listed in the appendixes at the
  99. end of this manual. 
  100.  
  101. @section(Keys and the Keyboard)
  102.  
  103.     Many times throught this manual we will be talking about
  104. @index(special keys) commands and the keys on the keyboard needed use
  105. them.  There are a number of "special" keys which can be used and are
  106. listed here:
  107.  
  108. @begin(description)
  109. <NL>@\NewLine which is also called RETURN or ENTER, this key is used to
  110. @index(newline) end different commands. 
  111.  
  112. ^@\The control key can be used before any alphabetic character and some
  113. symbols.  For example, ^C means to hold down the <CONTROL> key and type
  114. @index(control key) the C key at the same time. 
  115.  
  116. ^X@\The CONTROL-X key is used at the beginning of many different
  117. @index(control-x) commands. 
  118.  
  119. META or M-@\This is a special EMACS key used to begin many commands as
  120. @index(meta key) well.  This key is pressed, and then released before
  121. typing the next character.  On most systems, this is the <ESC> key, but
  122. it can be changed.  (consult appendix D to learn what key is used for
  123. META on your computer).
  124. @end(description)
  125.  
  126. Whenever a command is described, the manual will list the actual
  127. keystokes needed to execute it in @b(boldface) using the above
  128. conventions, and also the name of the command in @i(italics).
  129. @section(Getting Started)
  130.  
  131.     In order to use EMACS, you must call it up from your system's or
  132. computer's command prompt.  On UNIX and MSDOS machines, just type
  133. "emacs" from the main command prompt and follow it with the <RETURN> or
  134. <ENTER> key (we will refer to this key as <NL> for "new-line" for the
  135. remainder of this manual).  On the Macintosh, the Amiga, the ATARI ST
  136. and other icon based operating systems, double click on the uEMACS icon.
  137. Shortly after this, a screen similar to the one below should appear.
  138.  
  139. @section(Parts and Pieces)
  140.  
  141.     The screen is divided into a number of areas or @b<windows>.  On
  142. some systems the top window contains a function list of unshifted and
  143. @index(windows) shifted function keys.  We will discuss these keys later. 
  144. @index(mode line) Below them is an EMACS @b<mode line> which, as we will
  145. see, informs you of the present mode of operation of the editor--for
  146. example "(WRAP)" if you set EMACS to wrap at the end of each line. 
  147. @index(text window) Under the mode line is the @b<text window> where text
  148. appears and is manipulated.  Since each window has its own mode line,
  149. below the text window is it's mode line.  The last line of the screen is
  150. the @b(command line) where EMACS takes commands and reports on what it
  151. is doing. 
  152.  
  153. @begin(verbatim)
  154. ===============================================================================
  155. f1 search      f2 search back : F1 toggle function list F2 toggle help file
  156. f3 hunt        f4 hunt back   : F3 find command/apropos F4 describe key
  157. f5 next window f6 exec macro  : F5 reformat paragraph    F6 ref undented region 
  158. f7 find file   f8 exec file   : F7 indent region    F8 undent region
  159. f9 save file  f10 exit emacs  : F9 execute DOS command F10 shell up
  160. ===============================================================================
  161. -- MicroEMACS 3.8i () -- Function Keys ---------------------------------------
  162. ===============================================================================
  163.  
  164.  
  165.  
  166.  
  167.  
  168.  
  169.  
  170.  
  171.  
  172.  
  173.  
  174.  
  175. ===============================================================================
  176. -- MicroEMACS 3.8i () -- Main ------------------------------------------------
  177. ===============================================================================
  178.         Fig 1:    EMACS screen on an IBM-PC
  179. @end(verbatim)
  180.  
  181. @section(Entering Text)
  182.  
  183. Entering text in EMACS is simple.  Type the following sentence fragment:
  184.  
  185. @quotation<Fang Rock lighthouse, center of a series of mysterious and>
  186.  
  187. @flushleft(The text is displayed at the top of the text window.  Now type:)
  188.  
  189. @quotation<terrifying events at the turn of the century>
  190.  
  191. Notice the text to the left of the cursor disappears and a '$' sign
  192. appears.  Don't panic--your text is safe!!! You've just discovered that
  193. EMACS doesn't "wrap" text to the next line like most word processors
  194. unless you hit <NL>.  But since EMACS is used for both word processing,
  195. and text editing, it has a bit of a dual personality.  You can change
  196. @index(modes) the way it works by setting various @b(modes).  In this
  197. case, you need to set @b(WRAP) mode, using the @i(add-mode)
  198. @index(add-mode) command, by typing @b(^X-M).  The command line at the
  199. base of the screen will prompt you for the mode you wish to add.  Type
  200. @b<wrap> followed by the <NL> key and any text you now enter will be
  201. wrapped.  However, the command doesn't wrap text already entered.  To
  202. get rid of the truncated line, delete characters with the <BACKSPACE>
  203. key until the '$' goes away.  Now type in the words you deleted, watch
  204. how EMACS goes down to the next line at the right time.  @i{(In some
  205. versions of EMACS, @b<WRAP> is a default mode in which case you don't
  206. have to worry about the instructions relating to adding this mode.)}
  207.  
  208. Now let's type a longer insert.  Hit <NL> a couple of times to tab
  209. down from the text you just entered.  Now type the following paragraphs. 
  210. Press <NL> twice to indicate a paragraph break. 
  211.  
  212. @quotation<Fang Rock lighthouse, center of a series of mysterious and
  213. terrifying events at the turn of the century, is built on a rocky island
  214. a few miles of the Channel coast.  So small is the island that wherever
  215. you stand its rocks are wet with sea spray. 
  216.  
  217. The lighthouse tower is in the center of the island.  A steep flight of
  218. steps leads to the heavy door in its base.  Winding stairs lead up to
  219. the crew room.>
  220.  
  221. @section<Basic cursor movement>
  222.  
  223. Now let's practice moving around in this text.  To move the cursor back
  224. to the word "Winding," enter @b<M-B> @i(previous-word)
  225. @index(previous-word).  This command moves the cursor backwards by one
  226. word at a time.  Note you have to press the key combination every time
  227. the cursor steps back by one word.  Continuously pressing META and
  228. toggling B produces an error message.  To move forward to the word
  229. "stairs" enter @b<M-F>, which moves the cursor forward by one word at a
  230. time. 
  231.  
  232. Notice that EMACS commands are usually mnemonic--F for forward, B for
  233. backward, for example.
  234.  
  235. To move the cursor up one line, enter @b<^P> @i(previous-line)
  236. @index(previous-line), down one line @b<^N> @i(next-line)
  237. @index(next-line).  Practice this movement by moving the cursor to the
  238. word "terrifying" in the second line. 
  239.  
  240. The cursor may also be moved forward or backward in smaller increments. 
  241. To move forward by one character, enter @b<^F> @i(forward-character)
  242. @index(forward-character), to move backward, @b<^B>
  243. @i(backward-character) @index(backward-character).  EMACS also allows
  244. you to specify a number which is normally used to tell a command to
  245. execute many times.  To repeat most commands, press META and then the
  246. number before you enter the command.  Thus, the command META 5 ^F
  247. (@b<M-5^F>) will move the cursor forward by five characters.  Try moving
  248. around in the text by using these commands.  For extra practice, see how
  249. close you can come to the word "small" in the first paragraph by giving
  250. an argument to the commands listed here. 
  251.  
  252. Two other simple cursor commands that are useful to help us move around
  253. in the text are @b<M-N> @i(next-paragraph) @index(next-paragraph) which
  254. moves the cursor to the second paragraph, and @b<M-P>
  255. @i(previous-paragraph) @index(previous-paragraph) which moves it back to
  256. the previous paragraph.  The cursor may also be moved rapidly from one
  257. end of the line to the other.  Move the cursor to the word "few" in the
  258. second line.  Press @b<^A> @i(beginning-of-line)
  259. @index(beginning-of-line).  Notice the cursor moves to the word "events"
  260. at the beginning of the line.  Pressing @b<^E> @i(end-of-line)
  261. @index(end-of-line) moves the cursor to the end of the line. 
  262.  
  263. Finally, the cursor may be moved from any point in the file to the end
  264. or beginning of the file.  Entering @b{M->} @i(end-of-file)
  265. @index(end-of-file) moves the cursor to the end of the buffer, @b{M-<}
  266. @i(beginning-of-file) @index(beginning-of-file) to the first character
  267. of the file. 
  268.  
  269. @i(On the IBM-PC, the ATARI ST and many other machines, the cursor keys
  270. @index(cursor keys) can also be used to move the cursor about.  Also, if
  271. there is one available, moving the mouse will move the cursor.)
  272.  
  273. Practice moving the cursor in the text until you are comfortable with
  274. the commands we've explored in this chapter.
  275.  
  276. @section(Saving your text)
  277.  
  278. When you've finished practicing cursor movement, save your file.  Your
  279. @index(buffer) file currently resides in a @b<BUFFER>.  The buffer is a
  280. temporary storage area for your text, and is lost when the computer is
  281. turned off.  You can save the buffer to a file by entering @b<^X-^S>
  282. @i(save-file) @index(save-file).  Notice that EMACS informs you that
  283. your file has no name and will not let you save it. 
  284.  
  285. To save your buffer to a file with a different name than it's current
  286. one (which is empty), press @b<^X^W> @i(write-file) @index(write-file). 
  287. EMACS will prompt you for the filename you wish to write.  Enter the
  288. name @b<fang.txt> and press return.  On a micro, the drive light will
  289. come on, and EMACS will inform you it is writing the file.  When it
  290. finishes, it will inform you of the number of lines it has written to
  291. the disk. 
  292.  
  293. Congratulations!! You've just saved your first EMACS file!
  294. @newpage
  295. @heading(Chapter @value(chapter) Summary)
  296.  
  297.     In chapter @value(chapter), you learned how to enter text, how
  298. to use wrap mode, how to move the cursor, and to save a buffer.  The
  299. following is a table of the commands covered in this chapter and their
  300. corresponding key bindings:
  301.  
  302. @begin{verbatim}
  303. @u(Key Binding        Keystroke    Effect)
  304.  
  305. abort-command        @b<^G>        aborts current command
  306.  
  307. add-mode        @b<^XM>        allows addition of EMACS
  308.                     mode such as @b(WRAP)
  309.  
  310. backward-character    @b<^B>        moves cursor left one character
  311.  
  312. beginning-of-file    @b{M-<}        moves cursor to beginning of file
  313.  
  314. beginning-of-line    @b<^A>        moves cursor to beginning of line
  315.  
  316. end-of-file        @b{M->}        moves cursor to end of file
  317.  
  318. end-of-line        @b<^E>        moves cursor to end of line
  319.  
  320. forward-character    @b<^F>        moves cursor right one character
  321.  
  322. next-line        @b<^N>        moves cursor to next line
  323.  
  324. next-paragraph        @b<M-N>        moves cursor to next paragraph
  325.  
  326. next-word        @b<M-F>        moves cursor forward one word
  327.  
  328. previous-line        @b<^P>        moves cursor backward by one line
  329.  
  330. previous-paragraph    @b<M-P>        moves cursor to previous paragraph
  331.  
  332. previous-word        @b<M-B>        moves cursor backward by one word
  333.  
  334. save-file        @b<^X-^S>    saves current buffer to a file
  335.  
  336. write-file        @b<^X-^W>    save current buffer under a new name
  337. @end(verbatim)
  338. @newpage
  339. @chapter(Basic Editing--Simple Insertions and Deletions)
  340.  
  341. @section<A Word About Windows, Buffers, Screens, and Modes>
  342.  
  343. In the first chapter, you learned how to create and save a file in
  344. EMACS.    Let's do some more editing on this file.  Call up emacs by
  345. typing in the following command.
  346.  
  347. @b<emacs fang.txt>
  348.  
  349. @i(On icon oriented systems, double click on the uEMACS icon, usually a
  350. file dialog box of some sort will appear.  Choose @b(FANG.TXT) from the
  351. appropriate folder.)
  352.  
  353. Shortly after you invoke EMACS, the text should appear on the screen
  354. ready for you to edit.  The text you are looking at currently resides in
  355. a @b<buffer>.  A buffer is a temporary area of computer memory which is
  356. @index(buffer) the primary unit internal to EMACS -- this is the place
  357. where EMACS goes to work.  The mode line at the bottom of the screen
  358. lists the buffer name, @b<FANG.TXT> and the name of the file with which
  359. this buffer is associated, @b<FANG.TXT>
  360.  
  361. The computer talks to you through the use of its @b(screen).  This
  362. @index(screen) screen usually has an area of 24 lines each of 80
  363. characters across.  You can use EMACS to subdivide the screen into
  364. several separate work areas, or @b(windows), each of which can be
  365. @index(window) 'looking into' different files or sections of text.  Using
  366. windows, you can work on several related texts at one time, copying and
  367. moving blocks of text between windows with ease.  To keep track of what
  368. you are editing, each window is identified by a @b(mode line) on the
  369. @index(mode line) @index(buffer) last line of the window which lists the
  370. name of the @b(buffer) which it is looking into, the file from which the
  371. text was read, and how the text is being edited. 
  372.  
  373. An EMACS @b<mode> tells EMACS how to deal with user input.  As we have
  374. already seen, the mode 'WRAP' controls how EMACS deals with long lines
  375. (lines with over 79 characters) while the user is typing them in.  The
  376. 'VIEW' mode, allows you to read a file without modifying it.  Modes are
  377. associated with buffers and not with files; hence, a mode needs to be
  378. explicitly set or removed every time you edit a file.  A new file read
  379. into a buffer with a previously specified mode will be edited under this
  380. mode.  If you use specific modes frequently, EMACS allows you to set
  381. the modes which are used by all new buffers, called @b<global> modes. 
  382.  
  383. @section<Insertions>
  384.  
  385. Your previously-saved text should look like this:
  386.  
  387. @quotation<Fang Rock lighthouse, center of a series of mysterious and
  388. terrifying events at the turn of the century, is built on a rocky island
  389. a few miles of the Channel coast.  So small is the island that wherever
  390. you stand its rocks are wet with sea spray. 
  391.  
  392. The lighthouse tower is in the center of the island.  A steep flight of
  393. steps leads to the heavy door in its base.  Winding stairs lead up to
  394. the crew room.>
  395.  
  396. Let's assume you want to add a sentence in the second paragraph after
  397. the word "base."  Move the cursor until it is on the "W" of "Winding".
  398. Now type the following:
  399.  
  400. @quotation<This gives entry to the lower floor where the big steam
  401. generator throbs steadily away, providing power for the electric
  402. lantern.>
  403.  
  404. If the line fails to wrap and you end up with a '$' sign in the right
  405. margin, just enter @b{M-Q} @i(fill-paragraph) @index(fill-paragraph) to
  406. reformat the paragraph.  This new command attempts to fill out a
  407. paragraph.  Long lines are divided up, and words are shuffled around to
  408. make the paragraph look nicer. 
  409.  
  410. Notice that all visible EMACS characters are self-inserting -- all you
  411. had to do was type the characters to insert and the exisiting text made
  412. space for it.  With a few exceptions discussed later, all non-printing
  413. characters (such as control or escape sequences) are commands.  To
  414. insert spaces, simply use the space bar.  Now move to the first line of
  415. the file and type @b{^O} @i(open-line) @index(open-line) (Oh, not zero). 
  416. You've just learned how to insert a blank line in your text. 
  417.  
  418. @section<Deletions>
  419.  
  420. EMACS offers a number of deletion options.  For example, move the cursor
  421. until it's under the period at the end of the insertion you just did. 
  422. Press the backspace key.  Notice the "n" on "lantern" disappeared.  The
  423. backspace implemented on EMACS is called a @b<destructive> backspace--it
  424. removes text immediately before the current cursor position from the
  425. buffer.  Now type @b<^H> @i(delete-previous-character)
  426. @index(delete-previous-character).  Notice that the cursor moves back
  427. and obliterates the "r"--either command will backspace the cursor. 
  428.  
  429. Type in the two letters you erased to restore your text and move the
  430. cursor to the obeginning of the buffer @b{M->} @i(beginning-of-file)
  431. @index(beginning-of-file).  Move the cursor down one line to the
  432. beginning of the first paragraph. 
  433.  
  434. To delete the forward character, type @b{^D} @i(delete-next-character)
  435. @index(delete-next-character).  The "F" of "Fang" disappears.  Continue
  436. to type @b{^D} until the whole word is erased EMACS also permits the
  437. deletion of larger elements of text.  Move the cursor to the word
  438. "center" in the first line of text.  Pressing @b{M-<backspace>}
  439. @i(delete-previous-word) @index(delete-previous-word) kills the word
  440. immediately before the cursor.  @b{M-^H} has the same effect. 
  441.  
  442. Notice that the commands are very similar to the control commands you
  443. used to delete individual letters.  As a general rule in EMACS, control
  444. sequences affect small areas of text, META sequences larger areas.  The
  445. word forward of the cursor position can therefore be deleted by typing
  446. @b{M-D} @i(delete-next-word) @index(delete-next-word).  Now let's take
  447. out the remainder of the first line by typing @b{^K}
  448. @i(kill-to-end-of-line) @index(kill-to-end-of-line).  You now have a
  449. blank line at the top of your screen.  Typing @b{^K} again or @b{^X-^O}
  450. @i(delete-blank-lines) @index(delete-blank-lines) deletes the blank line
  451. and flushes the second line to the top of the text.  Now exit EMACS by
  452. typing @b{^X-^C} @i(exit-emacs) @index(exit-emacs).  Notice EMACS
  453. reminds you that you have not saved your buffer.  Ignore the warning and
  454. exit.  This way you can exit EMACS without saving any of the changes you
  455. just made. 
  456.  
  457. @heading(Chapter @value(chapter) Summary)
  458.  
  459. In Chapter @value(chapter), you learned about the basic 'building
  460. blocks' of an EMACS text file--buffers, windows, and files. 
  461.  
  462. @begin{verbatim}
  463. @u(Key binding        Keystroke    Effect)
  464. delete-previous-character
  465.             @b{^H}        deletes character immediately before
  466.                     the current cursor position
  467.  
  468. delete-next-character    @b{^D}        deletes character immediately after     
  469.                     current cursor position
  470.  
  471. delete-previous-word    @b{M-^H}    deletes word immediately before
  472.                     current cursor position
  473.  
  474. delete-next-word    @b{M-D}        deletes word immediately after
  475.                     current cursor position
  476.  
  477. kill-to-end-of-line    @b<^K>        deletes from current cursor
  478.                     position to end of line
  479.  
  480. insert-space        @b<^C>        inserts a space to right of cursor
  481.  
  482. open-line        @b{^O}        inserts blank line
  483.  
  484. delete-blank-lines    @b{^X-^O}    removes blank line
  485.  
  486. exit-emacs        @b{^X-^C}    exits emacs
  487. @end(verbatim)
  488. @chapter(Using Regions)
  489.  
  490. @section(Defining and Deleting a Region)
  491.  
  492. At this point its time to familiarize ourselves with two more EMACS
  493. terms--the @b<point> and the @b<mark>.  The point is located directly
  494. @index(point) @index(mark) behind the current cursor position.  The mark
  495. (as we shall see shortly) is user defined.  These two elements together
  496. are called the current @b(region) and limit the @b<region> of text on
  497. which EMACS performs many of its editing functions. 
  498.  
  499. Let's begin by entering some new text.  Don't forget to add @b(wrap)
  500. mode if its not set on this buffer.  Start EMACS and open a file called
  501. @b{PUBLISH.TXT}.  Type in the following text:
  502.  
  503. @quotation{One of the largest growth areas in personal computing is
  504. electronic publishing.  There are packages available for practically
  505. every machine from elegantly simple programs for the humble Commodore 64
  506. to sophisticated professional packages for PC and Macintosh computers. 
  507.  
  508. Electronic publishing is as revolutionary in its way as the Gutenburg
  509. press.  Whereas the printing press allowed the mass production and
  510. distribution of the written word, electronic publishing puts the means
  511. of production in the hands of nearly every individual.  From the class
  512. magazine to the corporate report, electronic publishing is changing the
  513. way we produce and disseminate information. 
  514.  
  515. Personal publishing greatly increases the utility of practically every
  516. computer.  Thousands of people who joined the computer revolution of
  517. this decade only to hide their machines unused in closets have
  518. discovered a new use for them as dedicated publishing workstations.}
  519.  
  520. Now let's do some editing.  The last paragraph seems a little out of
  521. place.  To see what the document looks like without it we can cut it
  522. from the text by moving the cursor to the beginning of the paragraph. 
  523. Enter @b(M-<space>) @i(set-mark) @index(set-mark).  EMACS will respond
  524. with "[Mark set]".  Now move the cursor to the end of the paragraph. 
  525. You have just defined a region of text.  To remove this text from the
  526. screen, type @b<^W> @i(kill-region) @index(kill-region).  The paragraph
  527. disappears from the screen. 
  528.  
  529. On further consideration, however, perhaps the paragraph we cut wasn't
  530. so bad after all.  The problem may have been one of placement.  If we
  531. could tack it on to the end of the first paragraph it might work quite
  532. well to support and strengthen the argument.  Move the cursor to the end
  533. of the first paragraph and enter @b<^Y> @i(yank) @index(yank).  Your
  534. text should now look like this:
  535.  
  536. @quotation{One of the largest growth areas in personal computing is
  537. electronic publishing.  There are packages available for practically
  538. every machine from elegantly simple programs for the humble Commodore 64
  539. to sophisticated professional packages for PC and Macintosh computers. 
  540. Personal publishing greatly increases the utility of practically every
  541. computer.  Thousands of people who joined the computer revolution of
  542. this decade only to hide their machines unused in closets have
  543. discovered a new use for them as dedicated publishing workstations. 
  544.  
  545. Electronic publishing is as revolutionary in its way as the Gutenburg
  546. press.  Whereas the printing press allowed the mass production and
  547. distribution of the written word, electronic publishing puts the means
  548. of production in the hands of nearly every individual.    From the class
  549. magazine to the corporate report, electronic publishing is changing the
  550. way we produce and disseminate information.}
  551.  
  552. @section(Yanking a Region)
  553.  
  554. The text you cut initially didn't simply just disappear, it was cut into
  555. a buffer that retains the 'killed' text appropriately called the @b<kill
  556. buffer>.  @b<^Y> "yanks" the text back from this buffer into the current
  557. buffer. If you have a long line (indicated, remember, by the "$"
  558. sign), simply hit @b{M-Q} to reformat the paragraph. 
  559.  
  560. There are other uses to which the kill buffer can be put.  Using the
  561. @index(kill buffer) method we've already learned, define the last
  562. paragraph as a region.  Now type @b<M-W> @i(copy-region)
  563. @index(copy-region).  Nothing seems to have happened; the cursor stays
  564. blinking at the point.  But things have changed, even though you may not
  565. be able to see any alteration. 
  566.  
  567. To see what has happened to the contents of the kill buffer, move the
  568. cursor down a couple of lines and "yank" the contents of the kill buffer
  569. back with @b<^Y>.  Notice the last paragraph is now repeated.  The
  570. region you defined is "tacked on" to the end of your file because
  571. @b<M-W> @b<copies> a region to the kill buffer while leaving the
  572. original text in your working buffer.  Some caution is needed however,
  573. because the contents of the kill buffer are updated when you delete any
  574. regions, lines or words.  If you are moving large quantities of text,
  575. complete the operation before you do any more deletions or you could
  576. find that the text you want to move has been replaced by the most recent
  577. deletion.  Remember--a buffer is a temporary area of computer memory
  578. that is lost when the machine is powered down or switched off.  In order
  579. to make your changes permanent, they must be saved to a file before you
  580. leave EMACS.  Let's delete the section of text we just added and save
  581. the file to disk. 
  582.  
  583. @heading(Chapter @value(chapter) Summary)
  584.  
  585. In Chapter @value(chapter), you learned how to achieve longer insertions
  586. and deletions.  The EMACS terms @b<point> and @b<mark> were introduced
  587. and you learned how to manipulate text with the kill buffer. 
  588.  
  589. @begin{verbatim}
  590. @begin(group)
  591. @u(Key Binding    Keystroke    Effect)
  592.  
  593. Delete-Region    @b{^W}        Deletes region between point and mark and
  594.                 places it in KILL buffer
  595.  
  596. Copy-Region    @b{M-W}        Copies text between point and mark into
  597.                 KILL buffer
  598.  
  599. Yank-Text    @b{^Y}        Inserts a copy of the KILL buffer into
  600.                 current buffer at point
  601. @end(group)
  602. @end(verbatim)
  603. @chapter(Search and Replace)
  604.  
  605. @section<Forward Search>
  606.  
  607. Load EMACS and bring in the file you just saved.  Your file should look
  608. like the one below.
  609.  
  610. @quotation{One of the largest growth areas in personal computing is electronic
  611. publishing.  There are packages available for practically every machine
  612. from elegantly simple programs for the humble Commodore 64 to
  613. sophisticated professional packages for PC and Macintosh computers. 
  614. Personal publishing greatly increases the utility of practically every
  615. computer.  Thousands of people who joined the computer revolution of
  616. this decade only to hide their machines unused in closets have
  617. discovered a new use for them as dedicated publishing workstations. 
  618.  
  619. Electronic publishing is as revolutionary in its way as the Gutenburg
  620. press.  Whereas the printing press allowed the mass production and
  621. distribution of the written word, electronic publishing puts the means
  622. of production in the hands of nearly every individual.    From the class
  623. magazine to the corporate report, electronic publishing is changing the
  624. way we produce and disseminate information.}
  625.  
  626. Let's use EMACS to search for the word "revolutionary" in the second
  627. paragraph.  Because EMACS searches from the current cursor position
  628. toward the end of buffers, and we intend to search forward, move the
  629. cursor to the beginning of the text.  Enter @b<^S> @i(search-forward)
  630. @index(search-forward).  Note that the command line now reads
  631.  
  632. "Search [] <META>:" 
  633.  
  634. EMACS is prompting you to enter the @b<search string> -- the text you
  635. want to find.  Enter the word @b<revolutionary> and hit the @b<META>
  636. key.  The cursor moves to the end of the word "revolutionary."
  637.  
  638. Notice that you must enter the <META> key to start the search.  If you
  639. @index(<NL>) simply press <NL> the command line responds with "<NL>". 
  640. Although this may seem infuriating to users who are used to pressing the
  641. return key to execute any command, EMACS' use of <META> to begin
  642. searches allows it to pinpoint text with great accuracy.  After every
  643. line wrap or carriage return, EMACS 'sees' a new line character (<NL>). 
  644. If you need to search for a word at the end of a line, you can specify
  645. this word uniquely in EMACS. 
  646.  
  647. In our sample text for example, the word "and" occurs a number of times,
  648. but only once at the end of a line.  To search for this particular
  649. occurance of the word, move the cursor to the beginning of the buffer
  650. and type @b(^S).  Notice that EMACS stores the last specified
  651. @index(default string) search string as the @b<default> string.  If you
  652. press @b{<META>} now, EMACS will search for the default string, in this
  653. case, "revolutionary."
  654.  
  655. To change this string so we can search for our specified "and" simply
  656. enter the word @b{and} followed by @b{<NL>}.  The command
  657. line now shows:
  658.  
  659. "search [and<NL>]<META>:"
  660.  
  661. Press @b{<META>} and the cursor moves to "and" at the end of the second
  662. last line.
  663.  
  664. @section<Exact Searches>
  665.  
  666. If the mode EXACT is active in the current buffer, EMACS searches on a case
  667. sensitive basis.  Thus, for example you could search for @b{Publishing}
  668. as distinct from @b{publishing}. 
  669.  
  670.  
  671. @section<Backward Search>
  672.  
  673. Backward searching is very similar to forward searching except that it
  674. is implemented in the reverse direction.  To implement a reverse search,
  675. type @b{^R} @i(search-reverse) @index(search-reverse).  Because EMACS
  676. makes no distinction between forward and backward stored search strings,
  677. the last search item you entered appears as the default string.  Try
  678. searching back for any word that lies between the cursor and the
  679. beginning of the buffer.  Notice that when the item is found, the point
  680. moves to the beginning of the found string (i.e., the cursor appears
  681. under the first letter of the search item). 
  682.  
  683. Practice searching for other words in your text.
  684.  
  685. @section<Searching and Replacing>
  686.  
  687. Searching and replacing is a powerful and quick way of making changes to
  688. your text.  Our sample text is about electronic publishing, but the
  689. correct term is 'desktop' publishing.  To make the necessary changes we
  690. need to replace all occurances of the word "electronic" with "desktop."
  691. First, move the cursor to the top of the current buffer with the @b(M-<)
  692. command.  Then type @b[M-R] @i(replace-string) @index(replace-string). 
  693. The command line responds:
  694.  
  695. "Replace []<META>:"
  696.  
  697. where the square brackets enclose the default string.  Type the word
  698. @b<electronic> and hit @b{<META>}.  The command line responds:
  699.  
  700. "with []<META>"
  701.  
  702. type @b{desktop<META>}.  EMACS replaces all instances of the original
  703. word with your revision.  Of course, you will have to captialize the
  704. first letter of "desktop" where it occurs at the beginning of a
  705. sentence.
  706.  
  707. You have just completed an @b<unconditional replace>.  In this
  708. operation, EMACS replaces every instance of the found string with the
  709. replacement string. 
  710.      
  711. @section<Query-Replace>
  712.  
  713. You may also replace text on a case by case basis.  The @b{M-^R}
  714. @i(query-replace-string) @index(query-replace-string) command causes
  715. EMACS to pause at each instance of the found string. 
  716.  
  717. For example, assume we want to replace some instances of the word
  718. "desktop" with the word "personal." Go back to the beginning of the
  719. current buffer and enter the @b(M-^R) @i(query-replace)
  720. @index(query-replace) command.  The procedure is very similar to that
  721. which you followed in the unconditional search/replace option.  When the
  722. search begins however, you will notice that EMACS pauses at each
  723. instance of "publishing" and asks whether you wish to replace it with
  724. the replacement string.  You have a number of options available for
  725. response:
  726.  
  727. @begin(verbatim)
  728. @u(    Response    Effect)
  729.     Y(es)    Make the current replacement and skip to the next
  730.         occurance of the search string
  731.  
  732.     N(o)    Do not make this replacement but continue
  733.  
  734.     !    Do the rest of the replacements with no more queries
  735.  
  736.     U(ndo)    Undo just the last replacement and query for it
  737.         again (This can only go back ONE time)
  738.  
  739.     ^G    Abort the replacement command (This action does not
  740.         undo previously-authorized replacements
  741.  
  742.     .    Same effect as ^G, but cursor returns to the point at
  743.         which the replacement command was given
  744.  
  745.     ?    This lists help for the query replacement command
  746. @end(verbatim)
  747.  
  748. Practice searching and searching and replacing until you feel
  749. comfortable with the commands and their effects.
  750. @begin(group)
  751. @heading(Chapter @value(chapter) Summary)
  752.  
  753. In this chapter, you learned how to search for specified strings of text
  754. in EMACS.  The chapter also dealt with searching for and replacing
  755. elements within a buffer. 
  756.  
  757. @begin(verbatim)
  758. @u(Key Binding        Keystroke             Effect)
  759.  
  760. Search-Forward        @b{^S}    Searches from point to end of buffer.
  761.                 Point is moved from current location to
  762.                 the end of the found string
  763.  
  764. Search-Backward        @b{^R}    Searches from point to beginning of buffer. 
  765.                 Point is moved from current location to
  766.                 beginning of found string
  767.  
  768. Replace            @b{M-R} Replace ALL ocurrences of search string with 
  769.                 specified (null) string from point to the
  770.                 end of the current buffer
  771.  
  772. Query-Replace           @b{M-^R}    As above, but pause at each found string
  773.                 and query for action
  774. @end(verbatim)
  775. @end(group)
  776. @chapter(Windows)
  777.  
  778. @section<Creating Windows>
  779.  
  780. We have already met windows in an earlier chapter.  In this chapter, we
  781. will explore one of EMACS' more powerful features -- text manipulation
  782. through multiple windowing.
  783.  
  784. You will recall that windows are areas of buffer text that you can see
  785. @index(windows) on the screen.  Because EMACS can support several screen
  786. windows simultaneously you can use them to look into different places in
  787. the same buffer.  You can also use them to look at text in different
  788. buffers.  In effect, you can edit several files at the same time. 
  789.  
  790. Let's invoke EMACS and pull back our file on desktop publishing by
  791. typing
  792.  
  793. @quotation<emacs publish.txt>
  794.  
  795. When the text appears, type the @b{^X-2} @i(split-current-window)
  796. @index(split-current-window) command.  The window splits into two
  797. windows.  The window where the cursor resides is called the @b<current>
  798. window -- in this case the bottom window.  Notice that each window has a
  799. text area and a mode line.  The @b(command line) is however, common to
  800. all windows on the screen. 
  801.  
  802. The two windows on your screen are virtually mirror images of each other
  803. because the new window is opened into the same buffer as the one you are
  804. in when you issue the Open-Window command.  All commands issued to EMACS
  805. are executed on the current buffer in the current window.
  806.  
  807. To move the cursor to the upper window (i.e., to make that window the
  808. current window, type @b{^X-P} @i(previous-window)
  809. @index(previous-window).  Notice the cursor moves to the upper or
  810. @b<previous> window.  Entering @b{^X-O} @i(next-window) moves to the
  811. @b{next} window.  Practice moving between windows.  You will notice that
  812. you can also move into the Function Key menu by entering these commands. 
  813.  
  814. Now move to the upper window.  Let's open a new file.  On the EMACS disk
  815. is a tutorial file.  Let's call it into the upper window by typing:
  816.  
  817. @quotation<@b[^X-^F] @i(find-file) @index(file-file)>
  818.  
  819. @flushleft(and press return.  Then enter the filename @b<emacs.tut>.)
  820.  
  821. In a short time, the tutorial file will appear in the window.  We now
  822. have two windows on the screen, each looking into different buffers.  We
  823. have just used the @b(^X- ^F) @i(find-file) @index(find-file) command to
  824. find a file and bring it into our current window. 
  825.  
  826. You can scroll any window up and down with the cursor keys, or with the
  827. commands we've learned so far.    However, because the area of visible
  828. text in each window is relatively small, you can scroll the current
  829. window a line at a time.  
  830.  
  831. Type @b{^X-^N} @i(move-window-down) @index(move-window-down)
  832.  
  833. The current window scrolls down by one line -- the top line of text
  834. scrolls out of view, and the bottom line moves towards the top of the
  835. screen.  You can imagine, if you like, the whole window slowly moving
  836. down to the end of the buffer in increments of one line.  The command
  837. @b{^X-^P} @i(move-window-up) @index(move-window-up) scrolls the window
  838. in the opposite direction. 
  839.  
  840. As we have seen, EMACS editing commands are executed in the current
  841. window, but the program does support a useful feature that allows you to
  842. scroll the @b<next> window.  @b<M-^Z> @i(scroll-next-up)
  843. @index(scroll-next-up) scrolls the next window up, @b{M-^U}
  844. @i(scroll-next-down) @index(scroll-next-down) scrolls it downward.  From
  845. the tutorial window, practice scrolling the window with the desktop
  846. publishing text in it up and down. 
  847.  
  848. When you're finished, exit EMACS without saving any changes in your
  849. files. 
  850.  
  851. Windows offer you a powerful and easy way to edit text.  By
  852. manipulating a number of windows and buffers on the screen
  853. simultaneously, you can perform complete edits and revisions on the
  854. computer screen while having your draft text or original data
  855. available for reference in another window. 
  856.  
  857. Experiment with splitting the windows on your screen.  Open windows into
  858. different buffers and experiment with any other files you may have.  ry
  859. editing the text in each window, but
  860. don't forget to save any changes you want to keep -- you still have to
  861. save each buffer separately.
  862.  
  863. @section(Deleting Windows)
  864.  
  865. @section(Resizing Windows)
  866.  
  867. @section(Other Window commands)
  868.  
  869. @newpage
  870. @heading(Chapter @value(chapter) Summary)
  871.  
  872. In Chapter @value(chapter) you learned how to manipulate windows and the
  873. editing flexibility they offer. 
  874.  
  875. @begin{verbatim}
  876. @u(Key Binding        Keystroke               Effect)
  877.  
  878. Open-Window        @b{^X-2}    Splits current window into two windows
  879.                     if space is available
  880.  
  881. Close-Windows        @b{^X-1}    Closes all windows except current
  882.                     window
  883.  
  884. Next-Window        @b{^X-O}    Moves point into next (i.e. downward)
  885.                     window
  886.  
  887. Previous-Window        @b{^X-P}     Moves point to previous (i.e. upward)
  888.                     window
  889.  
  890. Move-Window-Down    @b{^X-^N}    Scrolls current window down one line
  891.  
  892. Move-Window-Up        @b{^X-^P}    Scrolls current window up one line
  893.  
  894. Redraw-display        @b{M-!} or    Window is moved so line with point
  895.             @b{M-^L}    (with cursor) is at center of window
  896.  
  897. Grow-Window        @b{^X-^}    Current window is enlarged by one
  898.                     line and nearest window is shrunk by 
  899.                     one line
  900.  
  901. Shrink-Window        @b{^X-^Z}     Current window is shrunk by one line
  902.                     and nearest window is enlarged by one
  903.                     line
  904.  
  905. Clear-and-Redraw    @b{^L}        Screen is blanked and redrawn.  Keeps
  906.                     screen updates in sync with your
  907.                     commands
  908.  
  909. Scroll-Next-Up        @b{M-^Z}     Scrolls next window up by one line
  910.  
  911. Scroll-Next-Down    @b{M-^U}     Scrolls next window down by one line
  912. @end(verbatim)
  913. @chapter(Buffers)
  914.  
  915. @index(buffers) We have already learned a number of things about buffers. 
  916. As you will recall, they are the major internal entities in EMACS -- the
  917. place where editing commands are executed.  They are characterized by
  918. their @b<names>, their @b<modes>, and by the file with which they are
  919. associated.  Each buffer also "remembers" its @b(mark) and @b(point). 
  920. This convenient feature allows you to go to other buffers and return to
  921. the original location in the "current" buffer. 
  922.  
  923. Advanced users of EMACS frequently have a number of buffers in the
  924. computer's memory simultaneously.  In the last chapter, for example, you
  925. opoened at least two buffers -- one into the text you were editing, and
  926. the other into the EMACS on-line tutorial.  If you deal with complex
  927. text files -- say, sectioned chapters of a book, you may have five or
  928. six buffers in the computer's memory.  You could select different
  929. buffers by simply calling up the file with @b{^X-^F} @i(find-file)
  930. @index(find-file), and let EMACS open or reopen the buffer.  However,
  931. EMACS offers fast and sophisticated buffering techniques that you will
  932. find easy to master and much more convenient to use. 
  933.  
  934. Let's begin by opening three buffers.  You can open any three you
  935. choose, for example call the following files into memory: @b(fang.txt),
  936. @b(publish.txt), and @b(emacs.tut) in the order listed here.  When
  937. you've finished this process, you'll be looking at a screen showing the
  938. EMACS tutorial.  Let's assume that you want to move to the fang.txt
  939. buffer.  Enter:
  940.  
  941. @b{^X-X} @i(next-buffer) @index(next-buffer)
  942.  
  943. This command moves you to the @u<next> buffer.  Because EMACS cycles
  944. through the buffer list, which is alphabetized, you will now be in the
  945. @b(fang.txt) buffer. Using @b(^X-X) again places you in the
  946. @b(publish.txt) buffer. @i(If you are on a machine that supports
  947. function keys, using @b[^X-X] again places you in the @b(Function Keys)
  948. buffer). Using @b(^X-X) one last time cycles you back to the beginning
  949. of the list.
  950.  
  951. If you have a large number of buffers to deal with, this cycling process
  952. may be slow and inconvenient.  The command @b{^X-B} @i(select-buffer)
  953. @index(select-buffer) allows you to specify the buffer you wish to be
  954. switched to.  When the command is entered, EMACS prompts, "Use buffer:". 
  955. Simply enter the buffer name (NOT the file name), and that buffer will
  956. then become the current buffer. 
  957.  
  958. Multiple buffer manipulation and editing is a complex activity, and you
  959. will probably find it very inconvenient to re-save each buffer as you
  960. modify it.  The command @b{^X-^B} @i(list-buffers) @index(list-buffers)
  961. creates a new window that gives details about all the buffers currently
  962. known to EMACS.  Buffers that have been modified are identified by the
  963. "buffer changed" indicator (an asterisk in the second column).  You can
  964. thus quickly and easily identify buffers that need to be saved to files
  965. before you exit EMACS.  The buffer window also provides other
  966. information -- buffer specific modes, buffer size, and buffer name are
  967. also listed.  To close this window, simply type the close-windows
  968. command, @b{^X-1}. 
  969.  
  970. To delete any buffer, type @b{^X-K} @i(delete-buffer)
  971. @index(delete-buffer).  EMACS prompts you "Kill buffer:".  Enter the
  972. buffer name you want to delete.  As this is destructive command, EMACS
  973. will ask for confirmation if the buffer was changed and not saved. 
  974. Answer Y(es) or N(o).  As usual @b{^G} cancels the command. 
  975.  
  976. @newpage
  977. @heading(Chapter @value(chapter) Summary)
  978.  
  979. In Chapter @value(chapter) you learned how to manipulate buffers. 
  980.  
  981. @begin{verbatim}
  982. @u(Key Binding        Keystroke               Effect)
  983. Next-Buffer        @b(^X-^X)    Switch to the next buffer in the
  984.                     buffer list
  985.  
  986. Select-Buffer        @b(^X-B)    Switch to a particular buffer
  987.  
  988. List-Buffers        @b(^X-^B)    List all buffers
  989.  
  990. Delete-Buffer        @b(^X-K)    delete a particular buffer if it
  991.                     is off-screen
  992. @end(verbatim)
  993. @chapter(Modes)
  994.  
  995.     EMACS allows you to change the way it works in order to
  996. customized it to the style of editing you are using.  It does this by
  997. providing a number of different @b(modes) @index(modes).  These modes
  998. can effect either a single buffer, or any new buffer that is created. 
  999. To add a mode to the current buffer, type @b(^X-M) @i(add-mode)
  1000. @index(add-mode).  EMACS will then prompt you for the name of a mode to
  1001. add.  When you type in a legal mode name, and type a <NL>, EMACS will
  1002. add the mode name to the list of current mode names in the modeline of
  1003. the current buffer. 
  1004.  
  1005.     To remove an existing mode, typing the @b(^X-^M) @i(delete-mode)
  1006. @index(delete-mode) will cause EMACS to prompt you for the name of a
  1007. mode to delete from the current buffer.  This will remove that mode from
  1008. the mode list on the current modeline.
  1009.  
  1010.     Global modes are the modes which are inherited by any new
  1011. buffers which are created.  For example, if you wish to always do string
  1012. searching with character case being significant, you would want global
  1013. mode EXACT to be set so that any new files read in inherent the EXACT
  1014. mode.  Global modes are set with the @b(M-M) @i(add-global-mode)
  1015. @index(add-global-mode) command, and unset with the @b(M-^M)
  1016. @i(delete-global-mode) @index(delete-global-mode) command.  Also, the
  1017. current global modes are displayed in the first line of a
  1018. @b(^X-^B) @i(list-buffers) @index(list-buffers) command.
  1019.  
  1020.     On machines which are capable of displaying colors,
  1021. @index(color) the mode commands can also set the background and
  1022. forground character colors.  Using @i(add-mode) or @i(delete-mode) with
  1023. a lowercase color will set the background color in the current window. 
  1024. An uppercase color will set the forground color in the current window. 
  1025. Colors that EMACS knows about are: white, cyan, magenta, yellow, blue,
  1026. red, green, and black.  If the computer you are running on does not have
  1027. eight colors, EMACS will attempt to make some intellegent guess at what
  1028. color to use when you ask for one which is not there. 
  1029.  
  1030. @section(ASAVE mode)
  1031.  
  1032.     Automatic Save mode tells EMACS to automatically write out the
  1033. current buffer to its associated file on a regular basis.  Normally this
  1034. will be every 256 characters typed into the file.  The environment
  1035. variable $ACOUNT counts down to the next auto-save, and $ASAVE is the
  1036. value used to reset $ACOUNT after a save occurs. 
  1037.  
  1038. @section(CMODE mode)
  1039.  
  1040.     CMODE is useful to C programmers.  When CMODE is active, EMACS
  1041. will try to assist the user in a number of ways.  This mode is set
  1042. automatically with files that have a .c or .h extension. 
  1043.  
  1044.     The <NL> key will normally attempt to return the user to the next
  1045. line at the same level of indentation as the current line, unless the
  1046. current line ends with a open brace ({) in which case the new line will
  1047. be further indented by one tab position.
  1048.  
  1049.     A close brace (}) will delete one tab position preceeding itself
  1050. as it is typed.  This should line up the close brace with its matching
  1051. IF, FOR or WHILE statement. 
  1052.  
  1053.     A pound sign (#) with only leading whitespace will delete all
  1054. the whitespace preceeding itself. This will always bring preprocessor
  1055. directives flush to the left margin.
  1056.  
  1057.     Whenever any close fence is typed, ie )]>}, if the matching open
  1058. fence is on screen in the current window, the cursor will breifly flash
  1059. to it, and then back. This makes balencing expresions, and matching
  1060. blocks much easier.
  1061.  
  1062. @section(CRYPT mode)
  1063.  
  1064.     When a buffer is in CRYPT mode, @index(encryption) it is
  1065. encrypted whenever it is written to a file, and decrypted when it is
  1066. read from the file.  The encryption key can be specified on the command
  1067. line with the -k switch, or with the @b(M-E) @i(set-encryption-key)
  1068. @index(set-encryption-key) command.  If you attempt to read or write a
  1069. buffer in crypt mode and now key has not been set, EMACS will execute
  1070. @i(set-encryption-key) automatically, prompting you for the needed key. 
  1071. Whenever EMACS prompts you for a key, it will not echo the key to your
  1072. screen as you type it (ie make SURE you get it right when you set it
  1073. originally).
  1074.  
  1075.     The encryption algorithm used changes all characters into normal
  1076. printing characters, thus the resulting file is suitable for sending via
  1077. electronic mail.  All version of MicroEMACS should be able decrypt the
  1078. resulting file regardless of what machine encrypted it.  Also available
  1079. with EMACS is the stand alone program, MicroCRYPT, which can en/decrypt
  1080. the files produced by CRYPT mode in EMACS.
  1081.  
  1082. @section(EXACT mode)
  1083.  
  1084.     All string searches and replacements will take upper/lower case
  1085. into account. Normally the case of a string during a search or replace
  1086. is not taken into account.
  1087.  
  1088. @section(MAGIC mode)
  1089.  
  1090.      In the MAGIC mode certain characters gain special meanings when
  1091. used in a search pattern.  Collectively they are know as regular
  1092. expressions, and a limited number of them are supported in MicroEmacs. 
  1093. They grant greater flexability when using the search command.  However,
  1094. they do not affect the incremental search command. 
  1095.  
  1096.      The symbols that have special meaning in MAGIC mode are
  1097. ^, $, ., *, [ (and ], used with it), and \.
  1098.  
  1099.      The characters ^ and $ fix the search pattern to the beginning and
  1100. end of line, respectively.  The ^ character must appear at the beginning
  1101. of the search string, and the $ must appear at the end, otherwise they
  1102. loose their meaning and are treated just like any other character.  For
  1103. example, in MAGIC mode, searching for the pattern "t$" would put the
  1104. cursor at the end of any line that ended with the letter 't'.  Note that
  1105. this is different than searching for "t<NL>", that is, 't' followed by a
  1106. newline character.  The character $ (and ^, for that matter) matches a
  1107. position, not a character, so the cursor remains at the end of the line. 
  1108. But a newline is a character that must be matched, just like any other
  1109. character, which means that the cursor is placed just after it - on the
  1110. beginning of the next line. 
  1111.  
  1112.      The character .  has a very simple meaning -- it matches any single
  1113. character, except the newline.  Thus a search for "bad.er" could match
  1114. "badger", "badder" (slang), or up to the 'r' of "bad error". 
  1115.  
  1116.      The character * is known as closure, and means that zero or more of
  1117. the preceding character will match.  If there is no character preceding,
  1118. * has no special meaning, and since it will not match with a newline, *
  1119. will have no special meaning if preceded by the beginning of line symbol
  1120. ^ or the literal newline character <NL>. 
  1121.  
  1122.      The notion of zero or more characters is important.  If, for
  1123. example, your cursor was on the line
  1124.  
  1125. @quotation(This line is missing two vowels.)
  1126.  
  1127. and a search was made for "a*", the cursor would not move, because it is
  1128. guarenteed to match no letter 'a' , which satifies the search
  1129. conditions.  If you wanted to search for one or more of the letter 'a',
  1130. you would search for "aa*", which would match the letter a, then zero or
  1131. more of them. 
  1132.  
  1133.      The character [ indicates the beginning of a character class.  It
  1134. is similar to the 'any' character ., but you get to choose which
  1135. characters you want to match.  The character class is ended with the
  1136. character ].  So, while a search for "ba.e" will match "bane", "bade",
  1137. "bale", "bate", et cetera, you can limit it to matching "babe" and
  1138. "bake" by searching for "ba[bk]e".  Only one of the characters inside
  1139. the [ and ] will match a character.  If in fact you want to match any
  1140. character except those in the character class, you can put a ^ as the
  1141. first character.  It must be the first character of the class, or else
  1142. it has no special meaning.  So, a search for [^aeiou] will match any
  1143. character except a vowel, but a search for [aeiou^] will match any vowel
  1144. or a ^.
  1145.  
  1146. If you have a lot of characters in order that you want to put in the
  1147. character class, you may use a dash (-) as a range character.  So, [a-z]
  1148. will match any letter (or any lower case letter if EXACT mode is on),
  1149. and [0-9a-f] will match any digit or any letter 'a' through 'f', which
  1150. happen to be the characters for hexadecimal numbers.  If the dash is at
  1151. the beginning or end of a character class, it is taken to be just a
  1152. dash. 
  1153.  
  1154.      The escape character \ is for those times when you want to be in
  1155. MAGIC mode, but also want to use a regular expression character
  1156. to be just a character.  It turns off the special meaning of the
  1157. character.  So a search for "it\." will search for a line with "it.",
  1158. and not "it" followed by any other character.  The escape character
  1159. will also let you put ^, -, or ] inside a character class with no
  1160. special side effects.
  1161.  
  1162. @section(OVER mode)
  1163.  
  1164.     OVER mode stands for overwrite mode.  When in this mode, when
  1165. characters are typed, instead of simply inserting them into the file,
  1166. EMACS will attempt to overwrite an existing character past the point. 
  1167. This is very useful for adjusting tables and diagrams. 
  1168.  
  1169. @section(WRAP mode)
  1170.  
  1171.     Wrap mode is used when typing in continuous text.  Whenever the
  1172. cursor is past the currently set fill column @index(fill column) (72 by
  1173. default) and the user types a space or a <NL>, the last word of the line
  1174. is brought down to the beginning of the next line.  Using this, one just
  1175. types a continous stream of words and EMACS automatically inserts <NL>s
  1176. at appropriate places.
  1177.  
  1178. @center(NOTE to programmers:)
  1179.  
  1180. @quotation{EMACS actually calls up the function bound to the illegal
  1181. keystroke M-FNW.  This is bound to the function @i(wrap-word)
  1182. @index(wrap-word) by default, but can be re-bound to activate different
  1183. functions and macros at wrap time.}
  1184.  
  1185. @section(VIEW mode)
  1186.  
  1187.     VIEW mode disables all commands which can change the current
  1188. buffer.  EMACS will display an error message and ring the bell every
  1189. time you attempt to change a buffer in VIEW mode.
  1190. @newpage
  1191. @heading(Chapter @value(chapter) Summary)
  1192.  
  1193. In Chapter @value(chapter) you learned about modes and their effects.
  1194.  
  1195. @begin{verbatim}
  1196. @u(Key Binding        Keystroke               Effect)
  1197. Add-Mode        @b(^X-M)    Add a mode to the current buffer
  1198.  
  1199. Delete-Mode        @b(^X-^M)    Delete a mode from the current buffer
  1200.  
  1201. Add-Global-Mode        @b(M-M)        Add a global mode to the
  1202.                     current buffer
  1203.  
  1204. Delete-Global-Mode    @b(M-^M)    Delete a global mode from the
  1205.                     current buffer
  1206. @end(verbatim)
  1207. @chapter(Files)
  1208.  
  1209. A file is simply a collection of related data.  In EMACS we are dealing
  1210. with text files -- named collections of text residing on a disk (or some
  1211. other storage medium).  You will recall that the major entities EMACS
  1212. deals with are buffers.  Disk-based versions of files are only active in
  1213. EMACS when you are reading into or writing out of buffers.  As we have
  1214. already seen, buffers and physical files are linked by associated
  1215. filenames.  For example, the buffer "ch7.txt" which is associated with
  1216. the physical disk file "ch7.txt." You will notice that the file is
  1217. usually specified by the drive name or (in the case of a hard drive) a
  1218. path.  Thus you can specify full filenames in EMACS,
  1219.  
  1220. e.g. disk:\directories\filename.extension
  1221.  
  1222. If you do not specify a disk and directories, the default disk is used.
  1223.  
  1224. IMPORTANT -- If you do not explicitly save your buffer to a file, all your
  1225. edits will be lost when you leave EMACS (although EMACS will prompt you
  1226. when you are about to lose edits by exiting).  In addition, EMACS does
  1227. not protect your disk-based files from overwriting when it saves files. 
  1228. Thus when you instruct EMACS to save a file to disk, it will create a
  1229. file if the specified file doesn't exist, or it will overwrite the
  1230. previously saved version of the file thus replacing it.  Your old
  1231. version is gone forever. 
  1232.  
  1233. If you are at all unsure about your edits, or if (for any reason) you
  1234. wish to keep previous versions of a file, you can change the name of the
  1235. associated file with the command @b{^X-N}.  When this file is saved
  1236. to disk, EMACS will create a new physical file under the new name.  The
  1237. earlier disk file will be preserved.
  1238.  
  1239. For example, let's load the file @b{fang.txt} into EMACS.  Now, type
  1240. @b{^X-N}.  The EMACS command line prompts "name:".  Enter a new name
  1241. for the file -- say @b(new.txt) and press <NL>.  The file will be
  1242. saved under the new filename, and your disk directory will show both
  1243. @b(fang.txt) and @b(new.txt).
  1244.  
  1245. An alternative method is to write the file directly to disk under a new
  1246. filename.  Let's pull our "publish.txt" file into EMACS.  To write this
  1247. file under another filename, type @b{^X-^W}.  EMACS will prompt
  1248. you "write file:".  Enter an alternate filename -- @b{desktop.txt}. 
  1249. Your file will be saved as the physical file "desktop.txt".
  1250.  
  1251. Note that in the examples above, although you have changed the names of
  1252. the related files, the buffer names remain the same.  However, when you
  1253. pull the physical file back into EMACS, you will find that the buffer
  1254. name now relates to the filename.
  1255.  
  1256. For example -- You are working with a buffer "fang.txt" with the related
  1257. file "fang.txt".  You change the name of the file to "new.txt".  EMACS
  1258. now shows you working with the buffer "fang.txt" and the related file
  1259. "new.txt".  Now pull the file "new.txt" into EMACS.  Notice that the
  1260. buffer name has now changed to "new.txt". 
  1261.  
  1262. If for any reason a conflict of buffer names occurs,(if you have files
  1263. of the same name on different drives for example) EMACS will prompt
  1264. you "use buffer:".  Enter an alternative buffer name if you need to. 
  1265.  
  1266. For a list of file related commands (including some we`ve already
  1267. seen), see the summary page.
  1268. @newpage
  1269. @heading(Chapter @value(chapter) Summary)
  1270.  
  1271. In Chapter @value(chapter) you learned some of the more advanced
  1272. concepts of file naming and manipulation.  The relationship between
  1273. files and buffers was discussed in some detail. 
  1274.  
  1275. @begin(verbatim)
  1276. @u(Key Binding    Keystroke    Effect)
  1277.  
  1278. Save-file    @b{^X-^S}    Saves contents of current buffer with
  1279.                 associated filename on default disk/
  1280.                 directory (if not specified)
  1281.  
  1282. Write-File    @b{^X-^W}    Current buffer contents will be
  1283.                 saved under specified name 
  1284.  
  1285. Change-File-name
  1286.         @b{^X-N}    The associated filename is changed
  1287.                 (or associated if not previously
  1288.                 specified) as specified
  1289.  
  1290. Find-File    @b{^X-^F}    Reads specified file into buffer and 
  1291.                 switches you to that buffer, or switches
  1292.                 to buffer in which the file has previously
  1293.                 been read
  1294.  
  1295. Read-File    @b{^X-^R}    Reads file into buffer thus overwriting
  1296.                 buffer contents.  If file has already
  1297.                 been read into another buffer, you will
  1298.                 be switched to it
  1299.  
  1300. View-File    @b{^X-^V}    The same as read-file except the buffer
  1301.                 is automatically put into VIEW mode thus 
  1302.                 preventing any changes from being made
  1303. @end{verbatim}
  1304. @chapter(Screen Formatting)
  1305.  
  1306. @section<Wrapping Text>
  1307.  
  1308. As we learned in the introduction, EMACS is not a word processor, but an
  1309. editor.  Some simple formatting options are available however, although
  1310. in most cases they will not affect the appearence of the finished text
  1311. @index(wrapping text) when it is run through the formatter.  We have
  1312. already encountered WRAP mode which wraps lines longer than a certain
  1313. length (default is 75 characters).  You will recall that WRAP is enabled
  1314. by entering @b{^X-M} and responding to the command line prompt with
  1315. @b{wrap}. 
  1316.  
  1317. You can also set your own wrap margin with the command @b{^X-F}
  1318. @i(set-fill-column) @index(set-fill-column).  Notice EMACS responds
  1319. "[Fill column is 1]." Now try typing some text.  You'll notice some very
  1320. strange things happening -- your text wraps at every word!! This effect
  1321. occurs because the set wrap margin command must be preceeded by a
  1322. numeric argument or EMACS sets it to the first column.  Thus any text
  1323. you type that extends past the first column will wrap at the most
  1324. convenient line break. 
  1325.  
  1326. To reset the wrap column to 72 characters, press the @b{<META>} key and
  1327. enter 72.  EMACS will respond "Arg: 72".  Now press @b<^X-F>.  EMACS
  1328. will respond "[Fill column is 72]".  Your text will again wrap at the
  1329. margin you've been using up to this point.
  1330.  
  1331. @section<Reformatting Paragraphs>
  1332.  
  1333. After an intensive editing session, you may find that you have
  1334. paragraphs containing lines of differing lengths.  Although this
  1335. disparity will not affect the formatted text, aesthetic and technical
  1336. concerns may make it desirable to have consistent paragraph blocks on
  1337. the screen.  If you are in WRAP mode, you can reformat a paragraph with
  1338. the command @b{M-Q} @i(fill-paragraph) @index(fill-paragraph).  This
  1339. command 'fills' the current paragraph reformatting it so all the lines
  1340. are filled and wrap logically.  The process is complex, and (especially
  1341. with longer paragraphs) may take a little time. 
  1342.  
  1343. @section<Changing Case>
  1344.  
  1345. There may be occasions when you find it necessary to change the case of
  1346. the text you've entered.  EMACS allows you to change the case of even
  1347. large amounts of text with ease.  Let's try and convert a few of the
  1348. office traditionalists to the joy of word processing.  Type in the
  1349. following text:
  1350.  
  1351. @quotation{Throw away your typewriter and learn to use a word processor. 
  1352. Word processing is relatively easy to learn and will increase your
  1353. productivity enormously.  Enter the Computer Age and find out just how
  1354. much fun it can be!!}
  1355.  
  1356. Let's give it a little more impact by capitalizing the first four words. 
  1357. The first step is to define the region of text just as you would if you
  1358. were doing an extensive deletion.  Set the mark at the beginning of the
  1359. paragraph with @b{M-<space>} @i(set-mark) and move the cursor to the
  1360. space beyond "typewriter." Now enter @b{^X-^U} @i(case-region-upper). 
  1361. Your text should now look like this:
  1362.  
  1363. @quotation{THROW AWAY YOUR TYPEWRITER and learn to use a word processor. 
  1364. Word processing is relatively easy to learn and will increase your
  1365. productivity enormously.  Enter the Computer Age and find out just how
  1366. much fun it can be!!}
  1367.  
  1368. If you want to change the text back to lower case, type @b{^X-^L}
  1369. @i(case-region-lower) @index(case-region-lower).  You can also
  1370. capitalize individual words.  To capitalize the word "fun", position the
  1371. cursor in front of the word and type @b{M-U} @i(case-word-upper)
  1372. @index(case-word-upper).  The word is now capitalized.  To change it
  1373. back to lower case, move the cursor back to the beginning of the word
  1374. and type @b{M-L} @i(case-word-lower) @index(case-word-lower). 
  1375.  
  1376. You may also capitalize individual letters in EMACS.  The command
  1377. @b{M-C} @i(case-word-capitalize) @index(case-word-capitalize)
  1378. capitalizes the first letter after the point.  This command would
  1379. normally be issued with the cursor positioned in front of the first
  1380. letter of the word you wish to capitalize.  If you issue it in the
  1381. middle of a word, you can end up with some strAnge looking text. 
  1382.  
  1383. @section<Tabs>
  1384.  
  1385. Unless your formatter is instructed to take screen text literally (as
  1386. MicroSCRIBE does in the 'verbatim' environment for example), tabs in
  1387. EMACS generally affect screen formatting only. 
  1388.  
  1389. When EMACS is first started, it sets the default tab to every eighth
  1390. column.  As long as you stay with default, every time you press the tab
  1391. key a tab character, @b(^I) is inserted.  This character, like other
  1392. control characters, is invisible -- but it makes a subtle and
  1393. significant difference to your file and editing. 
  1394.  
  1395. For example, in default mode, press the tab key and then type the word
  1396. @b{Test}.  "Test" appears at the eighth column.  Move your cursor to the
  1397. beginning of the word and delete the backward character.  The word
  1398. doesn't move back just one character, but flushes to the left margin. 
  1399. The reason for this behavior is easily explained.  In tab default, EMACS
  1400. inserts a 'real' tab character when you press the tab key.  This
  1401. character is inserted at the default position, but NO SPACES are
  1402. inserted between the tab character and the margin (or previous tab
  1403. character).  As you will recall, EMACS only recognizes characters (such
  1404. as spaces or letters) and thus when the tab character is removed, the
  1405. text beyond the tab is flushed back to the margin or previous tab mark.
  1406.  
  1407. This situation changes if you alter the default configuration.  The
  1408. default value may be changed by entering a numeric argument before
  1409. pressing the tab key.  As we saw earlier, pressing the @b{META} key and
  1410. entering a number allows you to specify how EMACS performs a given
  1411. action.  In this case, let's specify an argument of 10 and hit the tab
  1412. key. 
  1413.  
  1414. Now hit the tab key again and type @b{Test}.  Notice the word now
  1415. appears at the tenth column.  Now move to the beginning of the word and
  1416. delete the backward character.    "Test" moves back by one character. 
  1417.  
  1418. EMACS behaves differently in these circumstances because the @b(^I)
  1419. @index(tab handling) @i(handle-tab) @index(handle-tab) function deals
  1420. with tabbing in two distinct ways.  In default conditions, or if the
  1421. numeric argument of zero is used, @i(handle-tab) inserts a true tab
  1422. character.  If, however, a non-zero numeric argument is specified,
  1423. @i(handle-tab) inserts the correct number of spaces needed to position
  1424. the cursor at the next specified tab position.  It does NOT insert the
  1425. single tab character and hence any editing functions should take account
  1426. of the number of spaces between tabbed columns. 
  1427.  
  1428. Many times you would like to take a line which has been created using
  1429. the tab character and change it to use just spaces.  The command
  1430. @b(^X-^D) @i(detab-line) @index(detab-line) changes any tabs from the
  1431. point to the end of the current line into the right number of spaces so
  1432. the line does not change.  This is very usefull for times when the file
  1433. must be printed or transfered to a machine which does not understand
  1434. tabs. 
  1435.  
  1436. Also, the inverse command, @b(^X-^E) @i(entab-lines) @index(entab-lines)
  1437. changes multiple spaces to tabs where possible.  This is a good way to
  1438. shrink the size of large documents, escpecially with data tables.  Both
  1439. of these commands can take a numeric argument which will be interpeted
  1440. as the number of lines to en/detab. 
  1441. @newpage
  1442. @heading(Chapter @value(chapter) Summary)
  1443.  
  1444. In Chapter @value(chapter) introduced some of the formatting features of
  1445. EMACS. Text-wrap, paragraph reformatting, and tabs were discussed in
  1446. some detail.  The commands in the following table were covered in the
  1447. chapter. 
  1448.  
  1449. @begin{verbatim}
  1450.  
  1451. @u(Key Binding        Keystroke            Effect)
  1452. Add-Mode/WRAP        @b{^X-M}[WRAP]    Add wrap mode to current buffer
  1453.  
  1454. Delete-Mode/WRAP    @b{^X-^M}[WRAP]    Remove wrap mode from current buffer
  1455.  
  1456. Set-Fill-Column        @b{^X-F}     Set fill column to given numeric
  1457.                     argument  
  1458.  
  1459. Fill-Paragraph        @b{M-Q}        Logically reformats the current
  1460.                     paragraph
  1461.  
  1462. Case-Word-Upper     @b{M-U}        Text from point to end of the
  1463.                     current word is changed to uppercase
  1464.  
  1465. Case-Word-Lower     @b{M-L}        Text from point to end of the 
  1466.                     current word is changed to lowercase
  1467.  
  1468. Case-Word-Capitalize    @b{M-C}        First word (or letter) after the
  1469.                     point is capitalized
  1470.  
  1471. Case-Region-Upper    @b{^X-^U}    The current region is uppercased
  1472.  
  1473. Case-Region-Lower    @b{^X-^L}    The current region is lowercased
  1474.  
  1475. Handle-Tab        @b{^I}        Tab interval is set to the given
  1476.                     numeric argument
  1477. Entab-Line        @b(^X-^E)    Changes multiple spaces to tabs
  1478.                     characters where possible
  1479. Detab-Line        @b(^X-^D)    Changes tab characters to the
  1480.                     apprpriate number of spaces
  1481. @end{verbatim}
  1482. @chapter(Keyboard Macros)
  1483.  
  1484. In many applications, it may be necessary to repeat a series of
  1485. characters or commands frequently.  For example, a paper may require the
  1486. frequent repetition of a complex formula or a long name.  You may also
  1487. have a series of EMACS commands that you invoke frequently.  Keyboard
  1488. macros offer a convenient method of recording and repeating these
  1489. commands. 
  1490.  
  1491. Imagine, for example, you are writing a scholarly paper on @i{Asplenium
  1492. platyneuron}, the spleenwort fern.  Even the dedicated botanist would
  1493. probably find it a task bordering on the agonizing to type
  1494. @i{Asplenium platyneuron} frequently throughout the paper.  An
  1495. alternative method is 'record' the name in a keyboard macro.  Try it
  1496. yourself.
  1497.  
  1498. The command @b{^X-(} @i(begin-macro) @index(begin-macro) starts
  1499. recording the all the keystrokes and commands you input.  After you've
  1500. typed it, enter @b{Asplenium platyneuron}.  To stop recording, type
  1501. @b{^X-)} @i(end-macro) @index(end-macro).  EMACS has stored all the
  1502. keystrokes between the two commands.  To repeat the name you've stored,
  1503. just enter @b{^X-E} @i(execute-macro) @index(execute-macro), and the
  1504. name "Asplenium platyneuron" appears.  You can repeat this action as
  1505. often as you want, and of course as with any EMACS command, you may
  1506. preceed it with a numerical argument. 
  1507.  
  1508. Because EMACS records keystrokes, you may freely intermix commands and
  1509. text.  Unfortunately, you can only store one macro at a time.  Thus, if
  1510. you begin to record another macro, the previously defined macro is
  1511. lost. Be careful to ensure that you've finished with one macro before
  1512. defining another.  If you have a series of commands that you would like
  1513. to 'record' for future use, use the macro or procedure facilities
  1514. detailed in chapter <X>.
  1515. @newpage
  1516. @heading(Chapter @value(chapter) Summary)
  1517.  
  1518. Chapter @value(chapter) covered keyboard macros.  You learned how to
  1519. record keystrokes and how to repeat the stored sequence. 
  1520.  
  1521. @begin{verbatim}
  1522. @u(Key Binding        Keystroke        Effect)
  1523.  
  1524. Start-Macro        @b{^X-(}    Starts recording all keyboard input
  1525.  
  1526. End-Macro        @b{^X-)}    Stops recording keystrokes for macro
  1527.  
  1528. Execute-Macro        @b{^X-E}    Entire sequence of recorded
  1529.                     keystrokes is replayed
  1530. @end{verbatim}
  1531. @chapter(MicroEMACS Macros)
  1532.  
  1533.     Macros are programs that are used to customize the editor and to
  1534. perform complicated editing tasks.  They may be stored in files or
  1535. buffers and may be executed using an appropriate command, or bound to a
  1536. particular keystroke.  Portions of the standard start-up file are
  1537. impliment via macros, as well as the example menu system.  The
  1538. @i(execute-macro-<n>) @index(execute-macro-<n>) commands cause the
  1539. macro, numbered from 1 to 40, to be executed.  The @i(execute-file)
  1540. @index(execute-file) command allows you to execute a macro stored in a
  1541. disk file, and the @i(execute-buffer) @index(execute-buffer) command
  1542. allows you to execute a macro stored in a buffer.  Macros are stored for
  1543. easy execution by executing files that contain the store-macro command. 
  1544.  
  1545.     There are many different aspects to the macro langage within
  1546. MicroEMACS.  Editor commands are the various commands that manipulate
  1547. text, buffers, windows, etc, within the editor.  Directives are commands
  1548. which control what lines get executed within a macro.  Also there are
  1549. various types of variables.  Environmental variables both control and
  1550. report on different aspects of the editor.  User variables hold string
  1551. values which may be changed and inspected.  Buffer variables allow text
  1552. to be placed into variables.  Interactive variable allow the program to
  1553. prompt the user for information.  Functions can be used to manipulate
  1554. all these variables. 
  1555.  
  1556. @section(Variables)
  1557.  
  1558.     Variables in MicroEMACS can be used to return values within
  1559. expressions, as repeat counts to editing commands, or as text to be
  1560. inserted into buffers and messages.  The value of these variables is set
  1561. using the set (^X-A) command.  For example, to set the current fill
  1562. column to 64 characters, the following macro line would be used:
  1563.  
  1564.     set $fillcol 64
  1565.  
  1566.     or to have the contents of @b(%name) inserted at the point in the
  1567. current buffer, the command to use would be:
  1568.  
  1569.     insert-string %name
  1570. @newpage
  1571. @subsection(Environmental Variables)
  1572.  
  1573.     "What good is a quote if you can't change it?"
  1574.  
  1575.     These variables are used to change different aspects of the way
  1576. the editor works.  Also they will return the current settings if used as
  1577. part of an expresion.  All environmental variable names begin with a
  1578. dollar sign ($) and are in lower case.
  1579.  
  1580. @begin(description)
  1581. $fillcol@\Current fill column
  1582.  
  1583. $pagelen@\Number of screen lines used currently
  1584.  
  1585. $curwidth@\Number of columns used currently
  1586.  
  1587. $curcol    @\Current column of point in current buffer
  1588.  
  1589. $curline@\Current line of point in current buffer
  1590.  
  1591. $flicker@\Flicker Flag set to TRUE if IBM CGA set to FALSE for most others
  1592.  
  1593. $cbufname@\Name of the current buffer
  1594.  
  1595. $cfname    @\File name of the current buffer
  1596.  
  1597. $sres@\Current screen resolution (CGA, MONO or EGA on the IBM-PC driver.
  1598. LOW, MEDIUM, HIGH or DENSE on the Atari ST1040,
  1599. NORMAL on all others)
  1600.  
  1601. $debug    @\Flag to trigger macro debugging (try it... you'll like it!)
  1602.  
  1603. $status    @\return status of the success of the last command
  1604. (TRUE or FALSE) usually used with !force
  1605.  
  1606. $palette@\string used to control the palette register
  1607. settings on graphics versions.    The usually form
  1608. consists of groups of three octal digits
  1609. setting the red, green, and blue levels.
  1610.  
  1611. $asave    @\The number of inserted characters between
  1612. automatic file-saves in ASAVE mode.
  1613.  
  1614. $acount    @\The coundown of inserted characters until
  1615. the next save-file.
  1616.  
  1617. $lastkey@\Last keyboard character typed
  1618.  
  1619. $curchar@\Character currently at the point
  1620.  
  1621. $discmd    @\Flag to disable the echoing of messages
  1622. on the command line
  1623.  
  1624. $version@\Contains the current MicroEMACS version number
  1625.  
  1626. $progname@\Always contains the string "MicroEMACS" for
  1627. standard MicroEMACS. Could be something else
  1628. if used as part of someone else's program
  1629.  
  1630. $seed@\integer seed of the random number generator
  1631.  
  1632. $disinp    @\Flag to disable the echoing of characters during command line input
  1633. @end(description)
  1634.  
  1635.     Obviously, many more of these variables will be availible in
  1636. future releases of MicroEMACS. (Yes, send a vote for your favorite new
  1637. environmental variables today).
  1638.  
  1639. @subsection(User variables)
  1640.  
  1641.     User variables allow you, the user, to store strings and
  1642. manipulate them.  These strings can be pieces of text, numbers (in text
  1643. form), or the logical values @b(TRUE) and @b(FALSE).  These variables
  1644. can be combined, tested, inserted into buffers, and otherwise used to
  1645. control the way your macros execute.  At the moment, up to 100 user
  1646. variables may be in use in one editing session.  All users variable
  1647. names must begin with a percent sign (%) and may contain any printing
  1648. characters.  Only the first 10 characters are significant (ie
  1649. differences beyond the tenth character are ignored).  Most operators
  1650. will truncate strings to a length of 128 characters. 
  1651.  
  1652. @subsection(Buffer Variables)
  1653.  
  1654.     Buffer variables are special in that they can only be queried
  1655. and cannot be set.  What buffer variables are is a way to take text from
  1656. a buffer and place it in a variable. For example, if I have a buffer by
  1657. the name of RIGEL2, and it contains the text:
  1658.  
  1659. @begin(verbatim)
  1660. @begin(group)
  1661.     Richmond
  1662.     Lafayette
  1663.     <*>Bloomington        (where <*> is the current point)
  1664.     Indianapolis
  1665.     Gary
  1666.     =* MicroEMACS 3.8i (WRAP) == rigel2 == File: /data/rigel2.txt =====
  1667. @end(group)
  1668. @end(verbatim)
  1669.  
  1670.     and within a command I reference #rigel2, like:
  1671.  
  1672.     insert-string #rigel2
  1673.  
  1674.     MicroEMACS would start at the current point in the RIGEL2
  1675. buffer and grab all the text up to the end of that line and pass that
  1676. back.  Then it would advance the point to the beginning of the next line.
  1677. Thus, after our last command executes, the string "Bloomington" gets
  1678. inserted into the current buffer, and the buffer RIGEL2 now looks like
  1679. this:
  1680.  
  1681. @begin(verbatim)
  1682. @begin(group)
  1683.     Richmond
  1684.     Lafayette
  1685.     Bloomington
  1686.     <*>Indianapolis        (where <*> is the current point)
  1687.     Gary
  1688.     =* MicroEMACS 3.8i (WRAP) == rigel2 == File: /data/rigel2.txt =====
  1689. @end(group)
  1690. @end(verbatim)
  1691.  
  1692.     as you have probably noticed, a buffer variable consists of the
  1693. buffer name, preceded by a pound sign (#).
  1694.  
  1695. @subsection(Interactive variables)
  1696.  
  1697.     Interactive variables are actually a method to prompt the user
  1698. for a string.  This is done by using an at sign (@@) followed either with
  1699. a quoted string, or a variable containing a string.  The string is the
  1700. placed on the bottom line, and the editor waits for the user to type in
  1701. a string.  Then the string typed in by the users is returned as the
  1702. value of the interactive variable.  For example:
  1703.  
  1704. @begin(verbatim)
  1705.     set %quest "What file? "
  1706.     find-file @@%quest
  1707. @end(verbatim)
  1708.  
  1709.     will ask the user for a file name, and then attempt to find it.
  1710.  
  1711. @section(Functions)
  1712.  
  1713.     Functions can be used to manipulate variables in various ways. 
  1714. Functions can have one, two, or three arguments.  These arguments will
  1715. always be placed after the function on the current command line.  For
  1716. example, if we wanted to increase the current fill column by two, using
  1717. emacs's set (^X-A) command, we would write:
  1718.  
  1719. @begin(group)
  1720. @begin(verbatim)
  1721.     set $fillcol &add $fillcol 2
  1722.      \    \      \      \     \____second operand
  1723.       \     \    \      \_________first operand
  1724.        \      \     \_______________function to execute
  1725.         \      \_____________________variable to set
  1726.          \___________________________set (^X-A) command
  1727. @end(verbatim)
  1728. @end(group)
  1729.  
  1730.     Function names always begin with the ampresand (&) character,
  1731. and are only significant to the first three characters after the
  1732. ampresand.  Functions will normal expect one of three types of
  1733. arguments, and will automatically convert types when needed.
  1734.  
  1735. @begin(description)
  1736. <num>@\an ascii string of digits which is interpeted as a numeric value. 
  1737. Any string which does not start with a digit or a minus sign (-) will be
  1738. considered zero. 
  1739.  
  1740. <str>@\An arbitrary string of characters.  At the moment, strings are
  1741. limited to 128 characters in length. 
  1742.  
  1743. <log>@\A logical value consisting of the string "TRUE" or "FALSE". 
  1744. Numeric strings will also evaluate to "FALSE" if they are equal to zero,
  1745. and "TRUE" if they are non-zero.  Arbitrary text strings will have the
  1746. value of "FALSE". 
  1747. @end(description)
  1748.  
  1749.     A list of the currently availible functions follows: (Once
  1750. again, send in those votes on what kind of functions you would like to
  1751. see added!) Functions are always used in lower case, the uppercase
  1752. letters in the function table are the short form of the function (ie
  1753. &div for ÷).
  1754.  
  1755. @begin(verbatim)
  1756. Numeric Functions:    (returns <num>)
  1757.  
  1758. &ADD        <num> <num>    Add two numbers
  1759. &SUB        <num> <num>    Subtract the second number from the first
  1760. &TIMes        <num> <num>    Multiply two numbers
  1761. &DIVide        <num> <num>    Divide the first number by the second
  1762.                 giving an integer result
  1763. &MOD        <num> <num>    Return the reminder of dividing the
  1764.                 first number by the second
  1765. &NEGate        <neg>        Multiply the arg by -1
  1766. &LENgth        <str>        Returns length of string
  1767. &ASCii        <str>        Return the ascii code of the first
  1768.                 character in <str>
  1769. &RND        <num>        Returns a random integer between 1 and <num>
  1770. &ABS        <num>        Returns the absolute value of <num>
  1771.  
  1772. String manipulation functions:    (returns <str>)
  1773.  
  1774. &CAT        <str> <str>    Concatinate the two strings to form one
  1775. &LEFt        <str> <num>    return the <num> leftmost characters
  1776.                 from <str>
  1777. &RIGht        <str> <num>    return the <num> rightmost characters
  1778.                 from <str>
  1779. &MID        <str> <num1> <num2>
  1780.                 Starting from <num1> position in <str>,
  1781.                 return <num2> characters.
  1782. &UPPer        <str>        Uppercase <str>
  1783. &LOWer        <str>        lowercase <str>
  1784. &CHR        <num>        return a string with the character
  1785.                 represented by ascii code <num>
  1786. >K                return a string containing a single
  1787.                 keystroke from the user
  1788.  
  1789. Logical Testing functions:    (returns <log>)
  1790.  
  1791. &NOT        <log>        Return the opposite logical value
  1792. &AND        <log1> <log2>    Returns TRUE if BOTH logical arguments
  1793.                 are TRUE
  1794. &OR        <log1> <log2>    Returns TRUE if either argument
  1795.                 is TRUE
  1796. &EQUal        <num> <num>    If <num> and <num> are numerically
  1797.                 equal, return TRUE
  1798. &LESs        <num1> <num2>    If <num1> is less than <num2>, return
  1799.                 TRUE.
  1800. &GREater    <num1> <num2>    If <num1> is greater than, or equal to
  1801.                 <num2>, return TRUE.
  1802. &SEQual        <str1> <str2>    If the two strings are the same, return
  1803.                 TRUE.
  1804. &SLEss        <str1> <str2>    If <str1> is less alphabetically than
  1805.                 <str2>, return TRUE.
  1806. &SGReater    <str1> <str2>    If <str1> is alphabetically greater than
  1807.                 or equal to <str2>, return TRUE.
  1808.  
  1809. Special Functions:
  1810.  
  1811. &INDirect    <str>        Evaluate <str> as a variable.
  1812. @end(verbatim)
  1813.  
  1814.     This last function deserves more explanation. The &IND function
  1815. evaluates its argument, takes the resulting string, and then uses it as
  1816. a variable name.  For example, given the following code sequence:
  1817.  
  1818. @begin(verbatim)
  1819.     ; set up reference table
  1820.  
  1821.     set %one    "elephant"
  1822.     se    "giraffe"
  1823.     set %t    "donkey"
  1824.  
  1825.     set %index "two"
  1826.     insert-string &ind %index
  1827. @end(verbatim)
  1828.  
  1829.     the string "giraffe" would have been inserted at the point in
  1830. the current buffer.  This indirection can be safely nested up to about
  1831. 10 levels.
  1832.  
  1833. @section(Directives)
  1834.  
  1835.     Directives are commands which only operate within an executing
  1836. macro, ie they do not make sense as a single command. As such, they
  1837. cannot be called up singly or bound to keystroke. Used within macros,
  1838. they control what lines are executed and in what order.
  1839.  
  1840.     Directives always start with the exclamation mark (!) character
  1841. and must be the first thing placed on a line. Directives executed singly
  1842. (via the execute-command-line command) interactively will be ignored.
  1843.  
  1844. @subsection(!ENDM Directive)
  1845.  
  1846.     This directive is used to terminate a macro being stored. For
  1847. example, if a file is being executed contains the text:
  1848.  
  1849. @begin(verbatim)
  1850.     ;    Read in a file in view mode, and make the window red
  1851.  
  1852.     26    store-macro
  1853.         find-file @@"File to view: "
  1854.         add-mode "view"
  1855.         add-mode "red"
  1856.     !endm
  1857.  
  1858.     write-message "[Consult macro has been loaded]"
  1859. @end(verbatim)
  1860.  
  1861.     only the lines between the store-macro command and the !ENDM
  1862. directive are stored in macro 26.
  1863.  
  1864. @subsection(!FORCE Directive)
  1865.  
  1866.     When MicroEMACS executes a macro, if any command fails, the
  1867. macro is terminated at that point. If a line is preceeded by a !FORCE
  1868. directive, execution continues weather the command succeeds or not. For
  1869. example:
  1870.  
  1871. @begin(verbatim)
  1872.     ;    Merge the top two windows
  1873.  
  1874.     save-window        ;remember what window we are at
  1875.     1 next-window        ;go to the top window
  1876.     delete-window        ;merge it with the second window
  1877.     !force restore-window    ;This will continue irregardless
  1878.     add-mode "red"
  1879. @end(verbatim)
  1880.  
  1881. @subsection(!IF, !ELSE, and !ENDIF Directives)
  1882.  
  1883.     This directive allows statements only to be executed if a
  1884. condition specified in the directive is met.  Every line following the
  1885. !IF directive, until the first !ELSE or !ENDIF directive, is only
  1886. executed if the expresion following the !IF directive evaluates to a
  1887. TRUE value.  For example, the following macro segment creates the
  1888. portion of a text file automatically.  (yes believe me, this will be
  1889. easier to understand then that last explanation....)
  1890.  
  1891. @begin(verbatim)
  1892.     !if &sequal %curplace "timespace vortex"
  1893.         insert-string "First, rematerialize~n"
  1894.     !endif
  1895.     !if &sequal %planet "earth"    ;If we have landed on earth...
  1896.         !if &sequal %time "late 20th century"  ;and we are then
  1897.             write-message "Contact U.N.I.T."
  1898.         !else
  1899.             insert-string "Investigate the situation....~n"
  1900.             insert-string "(SAY 'stay here Sara')~n"
  1901.         !endif
  1902.     !else
  1903.         set %conditions @@"Atmosphere conditions outside? "
  1904.         !if &sequal %conditions "safe"
  1905.             insert-string &cat "Go outside......" "~n"
  1906.             insert-string "lock the door~n"
  1907.         !else
  1908.             insert-string "Dematerialize..try somewhen else"
  1909.             newline
  1910.         !endif
  1911.     !endif
  1912. @end(verbatim)
  1913.  
  1914. @subsection(!GOTO Directive)
  1915.  
  1916.     Flow can be controlled within a MicroEMACS macro using the !GOTO
  1917. directive. It takes as an argument a label. A label consists of a line
  1918. starting with an asterick (*) and then an alphanumeric label.  Only
  1919. labels in the currently executing macro can be jumped to, and trying to
  1920. jump to a non-existing label terminates execution of a macro.  For
  1921. example..
  1922.  
  1923. @begin(verbatim)
  1924.     ;Create a block of DATA statements for a BASIC program
  1925.  
  1926.         insert-string "1000 DATA "
  1927.         set %linenum 1000
  1928.  
  1929.     *nxtin
  1930.         update-screen        ;make sure we see the changes
  1931.         set %data @@"Next number: "
  1932.         !if &equal %data 0
  1933.             !goto finish
  1934.         !endif
  1935.  
  1936.         !if &greater $curcol 60
  1937.             2 delete-previous-character
  1938.             newline
  1939.             set %linenum &add %linenum 10
  1940.             insert-string &cat %linenum " DATA "
  1941.         !endif
  1942.  
  1943.         insert-string &cat %data ", "
  1944.         !goto nxtin
  1945.  
  1946.     *finish
  1947.  
  1948.         2 delete-previous-character
  1949.         newline
  1950. @end(verbatim)
  1951.  
  1952. @subsection(!RETURN Directive)
  1953.  
  1954.     The !RETURN Directive causes the current macro to exit, either
  1955. returning to the caller (if any) or to interactive mode.  For example:
  1956.  
  1957. @begin(verbatim)
  1958.     ;    Check the monitor type and set %mtyp
  1959.  
  1960.     !if &sres "CGA"
  1961.         set %mtyp 1
  1962.         !return
  1963.     !else
  1964.         set %mtyp 2
  1965.     !endif
  1966.  
  1967.     insert-string "You are on a MONOCHROME machine!~n"
  1968. @end(verbatim)
  1969. @appendix(MicroEMACS commands)
  1970.  
  1971.     Below is a complete list of the commands in EMACS, the keys
  1972. normally used to do the command, and what the command does.  Remember,
  1973. on some computers there may also be additional ways of using a command
  1974. (cursor keys and special function keys for example). 
  1975.  
  1976. @begin(verbatim)
  1977. @u(Command            Binding        Meaning)
  1978. abort-command         ^G    This allows the user to abort out of any
  1979.                 command that is waiting for input
  1980.  
  1981. add-mode         ^X-M    Add a mode to the current buffer
  1982.  
  1983. add-global-mode      M-M    Add a global mode for all new buffers
  1984.  
  1985. apropos          M-A    List out commands whose name contains
  1986.                 the string specified
  1987.  
  1988. backward-character     ^B    Move one character to the left
  1989.  
  1990. begin-macro         ^X-(    Begin recording a keyboard macro
  1991.  
  1992. beginning-of-file     M-<    Move to the beginning of the file in
  1993.                 the current buffer
  1994.  
  1995. beginning-of-line     ^A    Move to the beginning of the current line
  1996.  
  1997. bind-to-key         M-K    Bind a key to a function
  1998.  
  1999. buffer-position      ^X-=    List the position of the cursor in the
  2000.                 current window on the command line
  2001.  
  2002. case-region-lower     ^X-^L    Make a marked region all lower case
  2003.  
  2004. case-region-upper     ^X-^U    Make a marked region all upper case
  2005.  
  2006. case-word-capitalize     M-C    Capitalize the following word
  2007.  
  2008. case-word-lower      M-L    Lower case the following word
  2009.  
  2010. case-word-upper      M-U    Upper case the following word
  2011.  
  2012. change-file-name     ^X-N    Change the name of the file in the
  2013.                 current buffer
  2014.  
  2015. change-screen-size     M-^S    Chnage the number of lines of the screen
  2016.                 currently being used
  2017.  
  2018. change-screen-width     M-^T    Change the number of columns of the
  2019.                 screen currently being used
  2020.  
  2021. clear-and-redraw     ^L    Clear the physical screen and redraw it
  2022.  
  2023. clear-message-line    (none)    Clear the command line
  2024.  
  2025. copy-region         M-W    Copy the currently marked region into
  2026.                 the kill buffer
  2027.  
  2028. count-words         M-^C    Count how many words, lines and
  2029.                 characters are in the current marked region
  2030.  
  2031. ctlx-prefix         ^X    Change the key used as the ^X prefix
  2032.  
  2033. delete-blank-lines     ^X-^O    Delete all blank lines around the cursor
  2034.  
  2035. delete-buffer         ^X-K    Delete a buffer which is not being
  2036.                 currently displayed in a window
  2037.  
  2038. delete-mode         ^X-^M    Turn off a mode in the current buffer
  2039.  
  2040. delete-global-mode     M-^M    Turn off a global mode
  2041.  
  2042. delete-next-character     ^D    Delete the character following the cursor
  2043.  
  2044. delete-next-word     M-D    Delete the word following the cursor
  2045.  
  2046. delete-other-windows     ^X-1    Make the current window cover the entire
  2047.                 screen
  2048.  
  2049. delete-previous-character^H    Delete the character to the left of the
  2050.                 cursor
  2051.  
  2052. delete-previous-word     M-^H    Delete the word to the left of the cursor
  2053.  
  2054. delete-window         ^X-0    Remove the current window from the screen
  2055.  
  2056. describe-bindings    (none)    Make a list of all legal commands
  2057.  
  2058. describe-key         ^X-?    Describe what command is bound to a
  2059.                 keystroke sequence
  2060.  
  2061. detab-line         ^X-^D    Change all tabs in a line to the
  2062.                 equivilant spaces
  2063.  
  2064. end-macro         ^X-)    stop recording a keyboard macro
  2065.  
  2066. end-of-file         M->    Move cursor to the end of the current buffer
  2067.  
  2068. end-of-line         ^E    Move to the end of the current line
  2069.  
  2070. entab-line         ^X-^E    Change multiple spaces to tabs where
  2071.                 possible
  2072.  
  2073. exchange-point-and-mark  ^X-^X    Move cursor to the last marked spot,
  2074.                 make the original position be marked
  2075.  
  2076. execute-buffer        (none)    Execute a buffer as a macro
  2077.  
  2078. execute-command-line    (none)    Execute a line typed on the command
  2079.                 line as a macro command
  2080.  
  2081. execute-file         FNB    Execute a file as a macro
  2082.  
  2083. execute-macro         ^X-E    Execute the keyboard macro (play back
  2084.                 the recorded keystrokes)
  2085. execute-macro-<n>    (none)    Execute numbered macro <N> where <N> is
  2086.                 an integer from 1 to 40
  2087.  
  2088. execute-named-command     M-X    Execute a command by name
  2089.  
  2090. execute-procedure     M-^E    Execute a procedure by name
  2091.  
  2092. exit-emacs         ^X-^C    Exit EMACS. If there are unwritten,
  2093.                 changed buffers EMACS will ask to confirm
  2094.  
  2095. fill-paragraph         M-Q    Fill the current paragraph
  2096.  
  2097. filter-buffer         ^X-#    Filter the current buffer through an
  2098.                 external filter
  2099.  
  2100. find-file         ^X-^F    Find a file to edit in the current window
  2101.  
  2102. forward-character     ^F    Move cursor one character to the right
  2103.  
  2104. goto-line         M-G    Goto a numbered line
  2105.  
  2106. goto-matching-fence     M-^F    Goto the matching fence
  2107.  
  2108. grow-window         ^X-^    Make the current window larger
  2109.  
  2110. handle-tab         ^I    Insert a tab or set tab stops
  2111.  
  2112. hunt-forward         FN=    Hunt for the next match of the last
  2113.                 search string
  2114.  
  2115. hunt-backward         FN>    Hunt for the last match of the last
  2116.                 search string
  2117.  
  2118. help             M-?    Read EMACS.HLP into a buffer and display it
  2119.  
  2120. i-shell          ^X-C    Shell up to a new command processor
  2121.  
  2122. incremental-search     ^X-S    Search for a string, incrementally
  2123.  
  2124. insert-file         ^X-^I    insert a file at the cursor in the
  2125.                 current file
  2126.  
  2127. insert-space         ^C    Insert a space to the right of the cursor
  2128.  
  2129. insert-string        (none)    Insert a string at the cursor
  2130.  
  2131. kill-paragraph         M-^W    Delete the current paragraph
  2132.  
  2133. kill-region         ^W    Delete the current marked region, moving
  2134.                 it to the kill buffer
  2135.  
  2136. kill-to-end-of-line     ^K    Delete the rest of the current line
  2137.  
  2138. list-buffers         ^X-^B    List all existing buffers
  2139.  
  2140. meta-prefix         <ESC>    Key used to preceed all META commands
  2141.  
  2142. move-window-down     ^X-^N    Move all the lines in the current window down
  2143.  
  2144. move-window-up         ^X-^P    Move all the lines in the current window up
  2145.  
  2146. name-buffer         M-^N    Change the name of the current buffer
  2147.  
  2148. newline          ^M    Insert a <NL> at the cursor
  2149.  
  2150. newline-and-indent     ^J    Insert a <NL> at the cursor and indent
  2151.                 the new line the same as the preceeding line
  2152.  
  2153. next-buffer         ^X-X    Bring the next buffer in the list into
  2154.                 the current window
  2155.  
  2156. next-line         ^N    Move the cursor down one line
  2157.  
  2158. next-page         ^V    Move the cursor down one page
  2159.  
  2160. next-paragraph         M-N    Move cursor to the next paragraph
  2161.  
  2162. next-window         ^X-O    Move cursor to the next window
  2163.  
  2164. next-word         M-F    Move coursor to the beginning of the
  2165.                 next word
  2166.  
  2167. open-line         ^O    Open a line at the cursor
  2168.  
  2169. pipe-command         ^X-@@    Execute an external command and place
  2170.                 its output in a buffer
  2171.  
  2172. previous-line         ^P    Move cursor up one line
  2173.  
  2174. previous-page         ^Z    Move cursor up one page
  2175.  
  2176. previous-paragraph     M-P    Move back one paragraph
  2177.  
  2178. previous-window      ^X-P    Move the cursor to the last window
  2179.  
  2180. previous-word         M-B    Move the cursor to the beginning of the
  2181.                 word to the left of the cursor
  2182.  
  2183. query-replace-string     M-^R    Reaplace all of one string with another
  2184.                 string, interactivly quering the user
  2185.  
  2186. quick-exit         M-Z    Exit EMACS, writing out all changed buffers
  2187.  
  2188. quote-character      ^Q    Insert the next character literally
  2189.  
  2190. read-file         ^X-^R    Read a file into the current buffer
  2191.  
  2192. redraw-display         M-^L    Redraw the display, centering the
  2193.                 current line
  2194.  
  2195. resize-window         ^X-W    Change the number of lines in the
  2196.                 current window
  2197.  
  2198. restore-window        (none)    Move cursor to the last saved window
  2199.  
  2200. replace-string         M-R    Replace all occurences of one string
  2201.                 with another string from the cursor
  2202.                 to the end of the buffer
  2203.  
  2204. reverse-incremental-search^X-R    Search backwards, incrementally
  2205.  
  2206. run             M-^E    Execute a named procedure
  2207.  
  2208. save-file         ^X-^S    Save the current buffer if it is changed
  2209.  
  2210. save-window        (none)    Remember current window (to restore later)
  2211.  
  2212. scroll-next-up         M-^Z    Scroll the next window up
  2213.  
  2214. scroll-next-down     M-^V    Scroll the next window down
  2215.  
  2216. search-forward         ^S    Search for a string
  2217.  
  2218. search-reverse         ^R    Search backwards for a string
  2219.  
  2220. select-buffer         ^X-B    Select a buffer to display in the
  2221.                 current window
  2222.  
  2223. set             ^X-A    Set a variable to a value
  2224.  
  2225. set-encryption-key     M-E    Set the encryption key of the current buffer
  2226.  
  2227. set-fill-column      ^X-F    Set the current fill column
  2228.  
  2229. set-mark            Set the mark
  2230.  
  2231. shell-command         ^X-!    Execute an external command
  2232.  
  2233. shrink-window         ^X-^Z    Make the current window smaller
  2234.  
  2235. split-current-window     ^X-2    Split the current window in two
  2236.  
  2237. store-macro        (none)    Store the following macro lines to a
  2238.                 numbered macro
  2239.  
  2240. store-procedure        (none)    Store the following macro lines to a
  2241.                 named procedure
  2242.  
  2243. transpose-characters     ^T    Transpose the character at the cursor
  2244.                 with the character to the left
  2245.  
  2246. trim-line         ^X-^T    Trim any trailing whitespace from line
  2247.  
  2248. unbind-key         M-^K    Unbind a key from a function
  2249.  
  2250. universal-argument     ^U    Execute the following command 4 times
  2251.  
  2252. unmark-buffer         M-~    Unmark the current buffer (so it is
  2253.                 no longer changed)
  2254.  
  2255. update-screen        (none)    Force a screen update during macro execution
  2256.  
  2257. view-file         ^X-^V    Find a file,and put it in view mode
  2258.  
  2259. wrap-word         M-FNW    Wrap the current word, this is an
  2260.                 internal function
  2261.      
  2262. write-file         ^X-^W    Write the current buffer under a new
  2263.                 file name
  2264.  
  2265. write-message        (none)    Display a string on the command line
  2266.  
  2267. yank             ^Y    yank the kill buffer into the current
  2268.                 buffer at the cursor
  2269. @end(verbatim)
  2270. @appendix(MicroEMACS Bindings)
  2271.  
  2272.     Below is a complete list of the key bindings used in MicroEMACS.
  2273. This can be used as a wall chart reference for MicroEMACS commands.
  2274.  
  2275. @begin(verbatim)
  2276. @center(@b[Default Key Bindings for MicroEmacs 3.8i])
  2277.  
  2278.  ^A   Move to start of line          ESC A   Apropos (list some commands)
  2279.  ^B   Move backward by characters     ESC B   Backup by words
  2280.  ^C   Insert space              ESC C   Initial capitalize word
  2281.  ^D   Forward delete              ESC D   Delete forward word
  2282.  ^E   Goto end of line              ESC E   Reset Encryption Key
  2283.  ^F   Move forward by characters      ESC F   Advance by words
  2284.  ^G   Abort out of things          ESC G   Go to a line
  2285.  ^H   Backward delete              
  2286.  ^I   Insert tab/Set tab stops
  2287.  ^J   Insert CR-LF, then indent             
  2288.  ^K   Kill forward              ESC K   Bind Key to function
  2289.  ^L   Refresh the screen          ESC L   Lower case word
  2290.  ^M   Insert CR-LF              ESC M   Add global mode
  2291.  ^N   Move forward by lines          ESC N   Goto End paragraph
  2292.  ^O   Open up a blank line          
  2293.  ^P   Move backward by lines          ESC P   Goto Begining of paragraph
  2294.  ^Q   Insert literal              ESC Q   Fill current paragraph
  2295.  ^R   Search backwards              ESC R   Search and replace
  2296.  ^S   Search forward
  2297.  ^T   Transpose characters               
  2298.  ^U   Repeat command four times       ESC U   Upper case word
  2299.  ^V   Move forward by pages          ESC V   Move backward by pages
  2300.  ^W   Kill region              ESC W   Copy region to kill buffer
  2301.  ^Y   Yank back from killbuffer       ESC X   Execute named command
  2302.  ^Z   Move backward by pages          ESC Z   Save all buffers and exit
  2303.  
  2304.  ESC ^C   Count words in region       ESC ~   Unmark current buffer
  2305.  ESC ^F   Goto matching fence          ESC !   Reposition window
  2306.  ESC ^H   Delete backward word          ESC <   Move to start of buffer
  2307.  ESC ^K   Unbind Key from function    ESC >   Move to end of buffer
  2308.  ESC ^L   Reposition window          ESC .   Set mark
  2309.  ESC ^M   Delete global mode          ESC space    Set mark
  2310.  ESC ^N   Rename current buffer       ESC rubout   Delete backward word
  2311.  ESC ^R   Search & replace w/query      rubout   Backward delete
  2312.  ESC ^S   Change screen rows
  2313.  ESC ^T   Change screen columns
  2314.  ESC ^V   Scroll next window down
  2315.  ESC ^W   Delete Paragraph
  2316.  ESC ^Z   Scroll next window up
  2317.  
  2318.  ^X ?    Describe a key           ^X !   Run 1 command in a subjob
  2319.  ^X =    Show the cursor position   ^X @@   Pipe DOS command to buffer
  2320.  ^X ^    Enlarge display window       ^X #   Filter buffer thru DOS filter
  2321.  ^X 0    Delete current window       ^X (   Begin macro
  2322.  ^X 1    Delete other windows       ^X )   End macro
  2323.  ^X 2    Split current window
  2324.                    ^X A   Set variable value
  2325.  ^X ^B     Display buffer list       ^X B   Switch a window to a buffer
  2326.  ^X ^C     Exit MicroEMACS       ^X C   Start a new command processer
  2327.                    ^X D   Suspend MicroEMACS (BSD4.2 only)
  2328.                    ^X E   Execute macro
  2329.  ^X ^F     Find file           ^X F   Set fill column
  2330.  ^X ^I     Insert file
  2331.                    ^X K   Delete buffer
  2332.  ^X ^L     Lower case region
  2333.  ^X ^M     Delete Mode           ^X M   Add a mode
  2334.  ^X ^N     Move window down       ^X N   Rename current filename
  2335.  ^X ^O     Delete blank lines       ^X O   Move to the next window
  2336.  ^X ^P     Move window up        ^X P   Move to the previous window
  2337.  ^X ^R     Get a file from disk       ^X R   Incremental reverse search
  2338.  ^X ^S     Save current file       ^X S   Incremental forward search
  2339.  ^X ^U     Upper case region
  2340.  ^X ^V     View file
  2341.  ^X ^W     Write a file to disk       ^X W   resize Window
  2342.  ^X ^X     Swap "." and mark       ^X X   Use next buffer
  2343.  ^X ^Z     Shrink window           ^X Z   Enlarge display window
  2344.  
  2345. Only under PCDOS:
  2346.  <ALT>-S Hunt forward         SHIFT <F1> - <F10>
  2347.  <ALT>-R Hunt backward         Execute macroes 1 - 10
  2348.  
  2349. @u(Usable Modes)
  2350. WRAP     Lines going past right margin "wrap" to a new line
  2351. VIEW     Read-Only mode where no modifications are allowed
  2352. CMODE     Change behavior of some commands to work with C better
  2353. EXACT     Exact case matching on search strings
  2354. OVER     Overwrite typed characters instead of inserting them
  2355. CRYPT     Current buffer will be encrypted on write, decrypted on read
  2356. MAGIC     Use regular expresion matching in searches
  2357. ASAVE     Save the file every 256 inserted characters
  2358.  
  2359. WHITE/CYAN/MAGENTA/YELLOW/BLUE/RED/GREEN/BLACK    Sets forground color
  2360. white/cyan/magenta/yellow/blue/red/green/black    Sets background color
  2361. @end(verbatim)
  2362. @newpage
  2363. @appendix(Supported machines)
  2364.  
  2365.     The following table lists all the hardware/compilers for which I
  2366. currently support MicroEMACS.  This is not exclusive of all machines
  2367. which MicroEMACS will run on, but I have either run it myself, or had a
  2368. first hand report of it running.
  2369.  
  2370. @begin(verbatim)
  2371. @u(Hardware    OS        Compiler    Comments)
  2372. VAX 780        UNIX V5        native
  2373.         UNIX V7        native
  2374.         BSD 4.2        native        job control supported
  2375.         *VMS        native        only some terminals supported
  2376.  
  2377. NCR Tower    UNIX V5        native
  2378.  
  2379. Fortune 32:16    UNIX V7        native
  2380.  
  2381. IBM-PC        MSDO        LATTICE    2.15    Large CODE/Large DATA
  2382.          2.0 & 3.2    AZTEC 3.4e    Small CODE/Large DATA
  2383.                 *MSC 4.0
  2384.                 *MWC 86
  2385.  
  2386. HP150        MSDOS        Lattice 2.15    Function key labels
  2387.                         for the touch screen
  2388.  
  2389. HP110        MSDOS        Lattice 2.15
  2390.                 Aztec 3.4e
  2391.  
  2392. *Data General 10
  2393.         MSDOS        Lattice 2.15
  2394.  
  2395. *Texas Instruments Professional
  2396.         MSDOS        Lattice 2.15
  2397.  
  2398. Amiga        Intuition    Lattice 3.03    no mouse or menus yet
  2399.                 *Aztec 3
  2400.  
  2401. ST520        TOS        Lattice 3.10    no menus yet,
  2402.                         no shell commands
  2403.  
  2404. @u[Systems to be supported (ie some code is already written:)]
  2405. Macintosh    Finder 5.0    Aztec
  2406.  
  2407. *means that I do not own or have access to the listed compiler and/or
  2408.  machine and must rely upon others to help support it. 
  2409. @end(verbatim)
  2410. @newpage
  2411. @appendix(Machine Dependent Notes)
  2412.  
  2413.     This appendix lists some notes specific to individual
  2414. implementations of MicroEMACS. Every attempt has been made to allow
  2415. EMACS to be identical on all machines, but we have also tried to take
  2416. advantage of function keys, cursor keys, mice, and special screen modes
  2417. where possible.
  2418.  
  2419. @appendixsection(IBM-PC/XT/AT and its clones)
  2420.  
  2421.     The IBM-PC family of computers is supported with a variety of
  2422. different display adapters.  EMACS will attempt to discover what adapter
  2423. is connected and use the proper driver for it.    Below is a list of the
  2424. currently supported video adapters:
  2425.  
  2426. @begin(verbatim)
  2427. @u(Adapter            $sres        Original mode used)
  2428. Monochrome Graphics Adapter    MONO        MONO
  2429. Color Graphics Adapter        CGA        CGA
  2430. Enhanced graphics Adapter    EGA        CGA
  2431. @end(verbatim)
  2432.  
  2433.     EMACS also takes advatage of various function keys and the keys
  2434. on the keypad on an IBM-PC.  The function keys are initially not bound
  2435. to any particular functions (except by the emacs.rc startup file), but
  2436. the keypad keys do default to the following:
  2437.  
  2438. @begin(verbatim)
  2439. @u(Keypad key    Function)
  2440. Home        beginning-of-file
  2441. CSRS UP        previous-line
  2442. Pg Up        previous-page
  2443. CSRS LEFT    backward-character
  2444. CSRS RIGHT    forward-character
  2445. End        end-of-file
  2446. CSRS DOWN    next-line
  2447. Pg Dn        Next-page
  2448. @end(verbatim)
  2449.  
  2450.     All these special keys are indicated in EMACS macroes by use of
  2451. the @b(FN) prefix.  Below is a list of many of the keys and the codes
  2452. used to specify them.  Also the codes may be gotten by using the
  2453. describe-key (^X ?) command on the suspect key.
  2454. @newpage
  2455. @begin(verbatim)
  2456.             IBM PC function keys in MicroEmacs
  2457.  
  2458.     function    Function    ^function    Alt-function
  2459.  f1)      FN;          FNT          FN^          FNh
  2460.  f2)      FN<          FNU          FN_          FNi
  2461.  f3)      FN=          FNV          FN`          FNj
  2462.  f4)      FN>          FNW          FNa          FNk
  2463.  f5)      FN?          FNX          FNb          FNl
  2464.  f6)      FN@@          FNY          FNc          FNm
  2465.  f7)      FNA          FNZ          FNd          FNn
  2466.  f8)      FNB          FN[          FNe          FNo
  2467.  f9)      FNC          FN\          FNf          FNp
  2468. f10)      FND          FN]          FNg          FNq
  2469.  
  2470. home)      FNG                  FNw
  2471. CuUp)      FNH
  2472. PgUp)      FNI                  FN„ {Alt 132}
  2473. CuLf)      FNK                  FNs
  2474.  5  )
  2475. CuRt)      FNM                  FNt
  2476.  End)      FNO                  FNu
  2477. CuDn)      FNP
  2478. PgDn)      FNQ                  FNv
  2479.  Ins)      FNR
  2480.  Del)      FNS
  2481. @end(verbatim)
  2482. @newpage
  2483. @appendixsection(Atari 520/1040ST)
  2484.  
  2485.     The ATARI ST family of computers have a dual personality.  They
  2486. may use either a monochrome or a color screen.    EMACS supports two
  2487. screen resolutions on each monitor. 
  2488.  
  2489. @begin(verbatim)
  2490. @u(Monitor $sres size #color $palette format)
  2491. Color    LOW    40x25    16    000111222333444555666777
  2492.     MEDIUM    80x25    4    000111222333
  2493. Mono    HIGH    80x25    2    000
  2494.     DENSE    80x40    2    000
  2495. @end(verbatim)
  2496.  
  2497.     The $palette environment variable can be used to change what
  2498. color is associated with each color name.  With a color monitor, each
  2499. group of three digits indicates an octal number specifying the RED,
  2500. GREEN and BLUE levels of that color.  Each color digit can vary from 0
  2501. to 7.  For example, the initial setting of $palette in LOW resolution is:
  2502.  
  2503. @begin(verbatim)
  2504.     000700070770007707077777
  2505.  
  2506.     which broken up is:
  2507.  
  2508.     000 700 070 770 007 707 077 777
  2509.  
  2510.     which means:
  2511.  
  2512.     000    Black
  2513.     700    Red
  2514.     070    Green
  2515.     770    Yellow
  2516.     007    Blue
  2517.     707    Magenta
  2518.     077    Cyan
  2519.     777    White
  2520. @end(verbatim)
  2521.  
  2522. @quotation[@i(Note: DENSE mode is not yet supported in 3.8i.  It will be
  2523. soon)]
  2524.  
  2525.     Also the mouse generates FN prefix codes when moved, or when one
  2526. of the two buttons is pressed.    Initially the movement of the mouse is
  2527. bound to movement of the cursor, and the left mouse button generates a
  2528. set-mark (M-space) command.  The cursor keys and the function keys are
  2529. bound similarly to to IBM-PC.
  2530. @newpage
  2531. @appendixsection(Amiga 1000)
  2532.  
  2533.     The Commodore AMIGA 1000 version of MicroEMACS does not have
  2534. extensive support of the mouse or of pull down menus as of yet.  It does
  2535. however come up in a window, and it is possible to re-size it to run in
  2536. different sized windows.  The @b(M-^S) @i(change-screen-size)
  2537. @index(change-screen-size) takes its numeric argument as the new number
  2538. of lines for EMACS to use.  The @b(M-^T) @i(change-screen-width)
  2539. @index(change-screen-width) command allows you to change the number of
  2540. columns EMACS will use.  The defaults for these are 23 lines and 77
  2541. characters across for a full screen window.
  2542.  
  2543. @center(Note about Compiling MicroEMACS)
  2544.  
  2545. @begin(quotation)
  2546.     If you are compiling the sources on the AMIGA to produce an
  2547. executable image, and you are using the Lattice compiler, be sure to
  2548. give the CLI command 'STACK 40000' before compiling to make sure the
  2549. compiler has sufficient stack space to successfully complete
  2550. compiliation.
  2551. @end(quotation)
  2552. @newpage
  2553. @appendixsection(UNIX V5, V7, and BSD4.[23])
  2554.  
  2555.     MicroEMACS under UNIX utilizes the @b(TERMCAP) @index(termcap)
  2556. library to provide machine independent screen functions.  Make sure that
  2557. termcap is availible and properly set on your account before attempting
  2558. to use MicroEMACS. 
  2559.  
  2560.     Under systems which support job control, you can use the
  2561. @b(^X-D) @i(suspend-emacs) @index(suspend-emacs) command to place EMACS
  2562. into the background.  This carries a much smaller overhead than bringing
  2563. up a new shell under EMACS.  EMACS will properly redraw the screen when
  2564. you bring it back to the forground.
  2565.  
  2566.     With the addition of some very machine/operating system specific
  2567. code, EMACS can prevent two or more people from modifying the same file
  2568. at the same time.  @index(file locking) The upper level of a set of
  2569. functions to provide file locking exist in the source file @b(LOCK.C). 
  2570. It requires two machine specific functions written and linked into EMACS
  2571. for it to operate properly. 
  2572.  
  2573. @begin(verbatim)
  2574.     char *dolock(fname)
  2575.  
  2576.     char *fname;
  2577.  
  2578.     dolock() locks a file, preventing others from modifying it. If
  2579.     it succeeds, it returns NULL, otherwise it returns a pointer to
  2580.     a string in the form "LOCK ERROR: explination".
  2581.  
  2582.     char *undolock(fname)
  2583.  
  2584.     char *fname;
  2585.  
  2586.     undolock() unlocks a file, allowing others to modifying it. If
  2587.     it succeeds, it returns NULL, otherwise it returns a pointer to
  2588.     a string in the form "LOCK ERROR: explination".
  2589. @end(verbatim)
  2590.